Find Locations custom Java geoprocessing tool


Purpose
This sample demonstrates how to create a geoprocessing tool that mimics a geoprocessing model workflow. It executes several System geoprocessing tools in a chained fashion (that is, output of one tool is used as input of another). This sample also demonstrates implementation of dependencies between parameters. Values of some parameters change based on the value provided to upstream parameters. The tool in this sample allows you to specify a street from a street feature class using a SQL Expression. You can then find all food locations along the street and select only those types of foods you're interested in.
 
The inputs to this tool are as follows:
  • Streets feature class that contains all streets in a city
  • SQL Expression that allows you to select one or more streets from the streets feature class
  • Distance from the streets where you want to find food locations
  • All food locations in the city
  • Type of food you're interested in, such as fast food, lunch or dinner, or all
  • Type of food locations you want to buy food from, such as pizza parlors, restaurants, or gas stations

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Navigate to this sample's lib folder (findlocations/lib) and copy FindLocationsExt.jar into the <ArcGIS Desktop Install Dir>/java/lib/ext folder to deploy the custom extension.
  2. Open ArcCatalog and expand Toolboxes.
  3. Create a new toolbox under My Toolboxes providing a logical name: CustomGPFindLocations.
  4. Right-click CustomGPFindLocations, hover the mouse over Add, and click Tool. A dialog box opens.
  5. Expand FLFunctionFactory from the list of toolboxes, select FindLocations tool and click OK.
  6. To run this custom tool you must have the scratch workspace set to a valid folder. Ensure that you have a scratch workspace set.
  7. In ArcCatalog, double-click the custom tool and provide values for all the parameters.
  8. Click OK to execute the tool.


Download the files for Java
geoprocessing/customtool/FindLocations.java Geoprocessing tool class
geoprocessing/customtool/FLFunctionFactory.java Geoprocessing Function Factory class




Additional Requirements
  • ArcGIS Desktop Installed (ArcCatalog)

Development licensing Deployment licensing
Engine Developer Kit Engine Runtime