Executing geoprocessing tools from a script

Once you have determined the toolbox alias and then verified the accessibility of the tool based on your current license level, you are ready to add the execution of the tool to a script.

Getting ready

Now that you understand how to find the tools that are available and how to uniquely reference them, the next step is to put this together and execute a tool from a geoprocessing script. In this recipe, you can then execute the tool from your script.

How to do it…

  1. Open C:\ArcpyBook\Ch6\Crime_Ch6.mxd in ArcMap.
  2. Click on the Add Data button and add the EdgewoodSD.shp file to the table of contents.
  3. Turn off the Crime Density by School District and Burglaries in 2009 layers to get a better view of the EdgewoodSD ...

Get Programming ArcGIS 10.1 with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.