Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By : Donald Eric Pimpler, Eric Pimpler
Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By: Donald Eric Pimpler, Eric Pimpler

Overview of this book

Table of Contents (22 chapters)
Programming ArcGIS with Python Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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\Ch5\Crime_Ch5.mxd in ArcMap.

  2. Click on the Add Data button and add the EdgewoodSD.shp file to the table of contents from the c:\ArcpyBook\Ch5 folder.

  3. If needed, turn off the Crime Density by School District and Burglaries in 2009 layers to get a better view of the EdgewoodSD layer. There is only one polygon feature in this file. It represents the Edgewood School District. Now, we're going to write a script that clips the Burglaries in 2009 features to this school district.

  4. Open...