]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.gis/src/main/java/org/argeo/slc/gdal/OgrProcess.java
Improve JCR and GIS
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.gis / src / main / java / org / argeo / slc / gdal / OgrProcess.java
1 package org.argeo.slc.gdal;
2
3 import java.io.File;
4
5 import org.argeo.slc.core.execution.tasks.SystemCall;
6
7 public class OgrProcess implements Runnable {
8 private File source;
9 private File target;
10 private String targetSrs;
11 private String clipdst;
12
13 public void run() {
14 if (runOgr2Ogr()) {
15 SystemCall ogr2ogr = new SystemCall("ogr2ogr");
16 if (targetSrs != null)
17 ogr2ogr.arg("-t_srs", targetSrs);
18 if (clipdst != null)
19 ogr2ogr.arg("-clipdst", clipdst);
20
21 // target is before source in OGR!
22 ogr2ogr.arg(target.getAbsolutePath());
23 ogr2ogr.arg(source.getAbsolutePath());
24
25 ogr2ogr.run();
26 }
27 }
28
29 protected Boolean runOgr2Ogr() {
30 return targetSrs != null || clipdst != null;
31 }
32
33 public void setTargetSrs(String targetSrs) {
34 this.targetSrs = targetSrs;
35 }
36
37 public void setClipdst(String clipdst) {
38 this.clipdst = clipdst;
39 }
40
41 public File getSource() {
42 return source;
43 }
44
45 public void setSource(File source) {
46 this.source = source;
47 }
48
49 public File getTarget() {
50 return target;
51 }
52
53 public void setTarget(File target) {
54 this.target = target;
55 }
56
57 public String getTargetSrs() {
58 return targetSrs;
59 }
60
61 public String getClipdst() {
62 return clipdst;
63 }
64
65 }