Book Image

Programming ArcGIS 10.1 with Python Cookbook

By : Donald Eric Pimpler, Eric Pimpler
Book Image

Programming ArcGIS 10.1 with Python Cookbook

By: Donald Eric Pimpler, Eric Pimpler

Overview of this book

ArcGIS is an industry standard geographic information system from ESRI.This book will show you how to use the Python programming language to create geoprocessing scripts, tools, and shortcuts for the ArcGIS Desktop environment.This book will make you a more effective and efficient GIS professional by showing you how to use the Python programming language with ArcGIS Desktop to automate geoprocessing tasks, manage map documents and layers, find and fix broken data links, edit data in feature classes and tables, and much more."Programming ArcGIS 10.1 with Python Cookbook" starts by covering fundamental Python programming concepts in an ArcGIS Desktop context. Using a how-to instruction style you'll then learn how to use Python to automate common important ArcGIS geoprocessing tasks.In this book you will also cover specific ArcGIS scripting topics which will help save you time and effort when working with ArcGIS. Topics include managing map document files, automating map production and printing, finding and fixing broken data sources, creating custom geoprocessing tools, and working with feature classes and tables, among others.In "Python ArcGIS 10.1 Programming Cookbook" you'll learn how to write geoprocessing scripts using a pragmatic approach designed around an approach of accomplishing specific tasks in a Cookbook style format.
Table of Contents (21 chapters)
Programming ArcGIS 10.1 with Python Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a tool add-in


Tool add-ins are similar to buttons, with the exception that tools require some type of interaction with the map. The Zoom In tool, for example, is a type of tool. Tools should be placed inside a toolbar or tool palette. The properties are much the same as you'd find with a button. You'll also need to edit the Python script.

Getting ready

The Tool class has a number of properties including cursor, enabled, and shape. The cursor property sets the cursor for the tool when it is clicked, and is defined as an integer value corresponding to the cursor types, as follows:

By default, tools are enabled. This can be changed, though, by setting the enabled property to false. Finally, the shape property specifies the type of shape to be drawn and can be a line, rectangle, or circle. These properties are typically set inside the constructor for the tool which is defined by the __init__ method, as shown in the following code example. self refers to the current object (a tool in this...