I'm trying to run another programm from Java code:
String[] command = {"gdal_polygonize.py", "/home/user/myoldfiles/proceeded.tiff", "-mask", "/home/user/myoldfiles/biomass_02.08.14.tif", "-f", "'ESRI Shapefile'", "/home/user/myoldfiles/proceeded.shp", "DN"};
Process p = Runtime.getRuntime().exec(command);
I have no file proceeded.shp created in /home/user/myoldfiles/ The command output obtained with BufferedReader looks like:
Creating output /home/user/myoldfiles/proceeded.shp of format 'ESRI Shapefile'.
When I run next command in terminal(Ubuntu)
gdal_polygonize.py '/home/user/myoldfiles/proceeded.tiff' -mask '/home/user/myoldfiles/biomass_02.08.14.tif' -f 'ESRI Shapefile' '/home/user/myoldfiles/proceeded.shp'
It prints
Creating output /home/user/myoldfiles/proceeded.shp of format ESRI Shapefile.
0...10...20...30...40...50...60...70...80...90...100 - done.
And successfully creates proceeded.shp file. What am I doing wrong in Java code?
Thanks everybody for the help! I found solution here . The problem was in single quotes in 'ESRI Shapefile', I just deleted them and all works fine now!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.