mercredi 25 mars 2015

OSGeo4W commands in Java changing directory


I am currently using GDAL to convert shp files into geojson ones for a project I am working on. I currently have the following code:



public static void main(String[] args) throws ExecuteException, IOException {

String line = "C:\\OSGeo4W64\\OSGeo4W.bat";
CommandLine commandLine = CommandLine.parse(line);
commandLine.addArgument("cd \\file_destination");
commandLine.addArgument("$ ogr2ogr -f GeoJSON -t_srs crs:84 [name].geojson [name].shp");
DefaultExecutor executor = new DefaultExecutor();
executor.execute(commandLine);

}


The first part works fine and fires up the bat file but when I try to cd into the directory I want it doesn't work? Can anyone help me out here? I feel like it is something very trivial that I am missing here.





Aucun commentaire:

Enregistrer un commentaire