- import com.esri.arcgis.geoprocessing.GeoProcessor;
- import com.esri.arcgis.geoprocessing.tools.analysistools.Clip;
- // Initialize the GeoProcessor
- GeoProcessor gp = new GeoProcessor();
- Clip clip= new Clip("c:/data/mjrroads.shp", "c:/data/coasts.shp",
"c:/output/clipOutput.shp");
复制代码
- Clip clip = new Clip();
- clip.setInFeatures = "c:/data/mjrroads.shp";
- clip.setClipFeatures = "c:/data/coasts.shp";
- clip.setOutFeatureClass = "c:/output/clipOutput.shp";
复制代码
- GP.execute(clip, null);
复制代码
- // Intialize the Geoprocessor
- GeoProcessor gp = new GeoProcessor();
- // 使用web service中的toolbox
- gp.addToolbox("http://flame7:8399/arcgis/services;GP/Bestpathtoolbox");
- // 导入本地的shape文件
- ArrayList parameters = new ArrayList;
- parameters.add("C:\\sandiego\\source.shp");
- parameters.add("C:\\sandiego\\destination.shp");
- // 捕获execute执行结果
- IGeoProcessorResult result;
- result = gp.execute("CalculateBestPath", parameters, null);
复制代码
- com.esri.arcgis.geoprocessing.tools.analysistools.Clip
- com.esri.arcgis.geoprocessing.tools.datamanagementtools.Clip
复制代码
- // Initialize the Geoprocessor
- GPUtilities gpUtilities = new GPUtilities();
- IFeatureClass inputFeatureClass = gpUtilities.openFeatureClassFromStri
ng(inputData+"/canada/mjrroads.shp"); - IFeatureClass clipFeatureClass = gpUtilities.openFeatureClassFromStri
ng(inputData+"/canada/coasts.shp"); - Clip clip = new Clip(inputFeatureClass, clipFeatureClass, outputDirectory+"/clipOutput.shp");
- gp.execute(clip, null);
复制代码
- // Get the Cell Size environment value
- gp.setEnvironmentValue("cellsize", Double.valueOf(10.0));
- String env = (String) gp.getEnvironmentValue("cellsize");
- // Set the output Coordinate System environment
- gp.setEnvironmentValue("outputCoordinateSystem", "c:/Program Files/ArcGIS/Coordinate Systems/Projected Coordinate Systems/UTM/Nad 1983/NAD 1983 UTM Zone 21N.prj");
- // Reset the environment values to their defaults.
- gp.resetEnvironments();
复制代码