Executing tools from a script

As an ArcGIS user, you have almost certainly used the many available tools in ArcToolbox to accomplish your geoprocessing tasks. Some examples include Clip, Buffer, Feature Class to Feature Class, Add Field, and many more. Your scripts can execute any of the tools found in ArcToolbox. Remember that the tools available to you as a programmer are dependent upon the license level of ArcGIS Destkop that you are using. These tasks can be automated through the creation of a Python script that executes these tools programmatically.

How to do it…

  1. Follow these steps to learn how to execute a geoprocessing tool from your script. Open c:\ArcpyBook\Ch2\TravisCounty.mxd with ArcMap.
  2. Open the Python window.
  3. Import the arcpy package: ...

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.