Building a custom geoprocessing function tool (Calculate Area)


PurposeThis sample is intended 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.

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

How to use

See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).

  1. Open the solution file, review the code, and compile the project.
  2. The function factory will be automatically added to the Geoprocessor Function Factory component category.
  3. Create a custom toolbox in a folder or geodatabase of choice. ArcGIS Desktop and ArcGIS Engine developers can do this by using the IGPUtilities2.CreateToolboxFromFactory method. See How to create a toolbox from a function factory for details.
  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 and choose Add, Tool, Expand the AreaCalculation function factory, and select the Calculate Area tool, then click OK to add the tool to the custom toolbox.

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

Download the files for all languages

See Also:

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