Accessing geoprocessing tools and toolboxes


About accessing geoprocessing tools and toolboxes

Each existing geoprocessing toolbox is represented by a package. These classes can be found in the com.esri.arcgis.geoprocessing.tools packages. In each toolbox package there are classes representing each geoprocessing tool in the standard ArcGIS geoprocessing toolboxes. Use these classes to set up and run geoprocessing tools with the geoprocessor class.
To set up a geoprocessing tool class, set properties to indicate the inputs to a tool. Ensure all the required properties are set; you can also set properties marked as optional. To simplify matters, each class has a parameterized constructor, allowing you to initialize the tool with all the required properties in one line of code. See the following code example showing how to access the Clip tool and set its parameters:
[Java]
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");
Optionally, set the parameters for the tool. See the following code example: 
[Java]
Clip clip = new Clip();
clip.setInFeatures = "c:/data/mjrroads.shp";
clip.setClipFeatures = "c:/data/coasts.shp";
clip.setOutFeatureClass = "c:/output/clipOutput.shp";