Hello everyone, I'm trying to use the "Near" analysis tool and "Map to KML" conversion tools in java but both bring out the same error AutomationException: 0x80004005 - Unspecified error at com.esri.arcgis.geoprocessing.GeoProcessor.execute(Unknown Source)
here's the method for the Near analysis tool:-
public void executeNearTool() { try { System.out.print("\n**Creating GeoProcessor object..."); GP = new GeoProcessor(); gpu=new GPUtilities(); GP.setOverwriteOutput(true); System.out.println("done.");
Finally worked after throwing the path to both set methods right away // nearanalysis=new Near(); nearanalysis.setInFeatures("D:/#GP/Construct Shapefile/Construct.shp"); nearanalysis.setNearFeatures("D:/#GP/Egypt Power Plant/carma_egypt_power_plant_emissions_egypt_20002007future.shp"); //
I can't thank you enough for your time and help, thank you I was starting to doubt this will ever work
ldonahue, thanks for your reply. Unfortunately I modified the code as so and it still brings out the same error
// IFeatureClass infeature=gpu.openFeatureClassFromString("D:\\#GP\\Construct Shapefile\\Construct.shp"); IFeatureClass innearfeature=gpu.openFeatureClassFromString("D:\\#GP\\Egypt Power Plant\\carma_egypt_power_plant_emissions_egypt_20002007future.shp"); //
I couldn't find online anyone trying to implement the near toolbox in a java application and my entire graduation project is dependent on it :confused:
the # is just a symbol i'm used to name with to put a folder at the top
also I couldn't understand completely the difference between a feature class and a dataset, the folder "construct shapefile" for example has not only construct.shp, there is a .dbf , .prj, .sbn, .sbx, .xml and a .shx file with the same name "construct"
Open a shapefile In the following code example, the .shp file extension is not used when specifying the name of the shapefile to open:
ShapefileWorkspaceFactory wsf = new ShapefileWorkspaceFactory();
Workspace work = new Workspace(wsf.openFromFile(location, 0));
IFeatureClass featureClass = work.openFeatureClass("NameOfYourShapefile");
and at first it didn't show anything, I changed it back to the one slash / and it showed "Construct", so it is indeed reading the files from that directory correctly, I think the problem is with the geoprocessor object itself but I don't know