Calculate area geoprocessing function tool


PurposeThis sample is for developers who want to extend the geoprocessing framework by building new geoprocessing tools using ArcObjects. This sample explains how to build a geoprocessing function tool and describes the ArcObjects components necessary for building these tools. This sample function tool calculates the area of a polygon feature class.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and 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. Open the solution file, review the code, and compile the project. The function factory is automatically added to the Geoprocessor Function Factory component category.
  2. Register the DLL (in the Debug folder) with ESRIRegAsm utility.
  3. Create a custom toolbox in a folder or a geodatabase. ArcGIS Desktop and ArcGIS Engine developers can do this by using the IGPUtilities2.CreateToolboxFromFactory method.
  4. ArcGIS Desktop users also have the option to add the tool to a custom toolbox manually in ArcCatalog, ArcMap, or ArcGlobe. Right-click a custom toolbox, choose Add, click Tool, expand the AreaCalculation function factory, select the Calculate Area tool, and click OK. The tool is added to the custom toolbox.

Additional information

For details on creating a custom function tool toolbox, see How to create a toolbox from a function factory.

GPCalculateArea/CalculateAreaFunction.cs Source file containing code for the function and function factory.
Download the C# files
GPCalculateArea/CalculateAreaFunction.vb Source file containing code for the function and function factory.
Download the VB.NET files

Download the files for all languages

See Also:

Custom geoprocessing function tools
Building a custom geoprocessing function tool
How to create a toolbox from a function factory




Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime