ESRI included the functionality to build toolboxes and tools entirely in Python with ArcGIS v10.1. A python toolbox is simply a text file (.pyt) that defines the toolbox and one or more tools. ESRI states that once created, tools in a Python toolbox provide the following advantages:

  • Creating a Python toolbox allows you to take advantage of your Python knowledge and quickly proto-type and create fully functional geoprocessing tools.
  • The tool that you create is an integral part of geoprocessing, just like a system tool—you can open it from the Search or Catalog window, use it in ModelBuilder and the Python window, and call it from scripts.
  • You can write messages to the Results window and progress dialog box.
  • Using built-in documentation tools, you can provide documentation.
  • When the script is run as a script tool, arcpy is fully aware of the application (such as ArcMap) it was called from. Settings made in the application, such as arcpy.env.overwriteOutput and arcpy.env.scratchWorkspace, are available from ArcPy in your script tool.
history | show excerpt | excerpt history