Book description
Over 85 hands-on recipes to teach you how to automate your ArcGIS for Desktop geoprocessing tasks using Python
In Detail
The book kicks off with the fundamentals of starting to use Python with ArcGIS, followed by recipes on managing map documents and layers, including how to find and fix broken data links in these files.
In the second part of the book, you will learn to create custom geoprocessing tools and how to use the Attribute and Location tools to select specific features.
The third part of the book covers topics for advanced users including the REST API, and also teaches you how to use Python with ArcGIS Pro. The book finishes with appendices covering how to automate Python scripts, and the five things that should be at the back of every GIS programmer's mind.
What You Will Learn
- Manage your map document files, layer files, feature classes, and tables
- Programmatically update layer properties and symbology
- Find and fix broken data links in your map document files
- Automate map production, printing, and the creation of PDF map books
- Develop custom geoprocessing tools that can be shared with others
- Query and select data from feature classes and tables
- Create new feature classes or tables and add, update, and delete records
- Customize the ArcGIS for Desktop interface with Python add-ins
Table of contents
-
Programming ArcGIS with Python Cookbook Second Edition
- Table of Contents
- Programming ArcGIS with Python Cookbook Second Edition
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Preface
- 1. Fundamentals of the Python Language for ArcGIS
-
2. Managing Map Documents and Layers
- Introduction
- Referencing the current map document
- Referencing map documents on a disk
- Getting a list of layers in a map document
- Restricting the list of layers
- Zooming in to selected features
- Changing the map extent
- Adding layers to a map document
- Inserting layers into a map document
- Updating layer symbology
- Updating layer properties
- Working with time-enabled layers in a data frame
-
3. Finding and Fixing Broken Data Links
- Introduction
- Finding broken data sources in your map document and layer files
- Fixing broken data sources with MapDocument.findAndReplaceWorkspacePaths()
- Fixing broken data sources with MapDocument.replaceWorkspaces()
- Fixing individual layer and table objects with replaceDataSource()
- Finding broken data sources in all map documents in a folder
-
4. Automating Map Production and Printing
- Introduction
- Creating a list of layout elements
- Assigning a unique name to layout elements
- Restricting the layout elements returned by ListLayoutElements()
- Updating the properties of layout elements
- Getting a list of available printers
- Printing maps with PrintMap()
- Exporting a map to a PDF file
- Exporting a map to an image file
- Exporting a report
- Building a map book with Data Driven Pages and ArcPy mapping
- Publishing a map document to an ArcGIS Server service
- 5. Executing Geoprocessing Tools from Scripts
- 6. Creating Custom Geoprocessing Tools
- 7. Querying and Selecting Data
-
8. Using the ArcPy Data Access Module with Feature Classes and Tables
- Introduction
- Retrieving features from a feature class with SearchCursor
- Filtering records with a where clause
- Improving cursor performance with geometry tokens
- Inserting rows with InsertCursor
- Updating rows with UpdateCursor
- Deleting rows with UpdateCursor
- Inserting and updating rows inside an edit session
- Reading geometry from a feature class
- Using Walk() to navigate directories
- 9. Listing and Describing GIS Data
- 10. Customizing the ArcGIS Interface with Add-ins
- 11. Error Handling and Troubleshooting
-
12. Using Python for Advanced ArcGIS
- Introduction
- Getting started with the ArcGIS REST API
- Making HTTP requests and parsing the response with Python
- Getting layer information with the ArcGIS REST API and Python
- Exporting a map with the ArcGIS REST API and Python
- Querying a map service with the ArcGIS REST API and Python
- Geocoding with the Esri World Geocoding Service
- Using FieldMap and FieldMappings
- Using a ValueTable to provide multivalue input to a tool
- 13. Using Python with ArcGIS Pro
- A. Automating Python Scripts
- B. Five Python Recipes Every GIS Programmer Should Know
- Index
Product information
- Title: Programming ArcGIS with Python Cookbook - Second Edition
- Author(s):
- Release date: July 2015
- Publisher(s): Packt Publishing
- ISBN: 9781785282898
You might also like
book
Programming ArcGIS 10.1 with Python Cookbook
This book provides the recipes you need to use Python with AcrGIS for more effective geoprocessing. …
book
Python Geospatial Development - Third Edition
Develop sophisticated mapping applications from scratch using Python 3 tools for geospatial development About This Book …
book
QGIS Python Programming Cookbook - Second Edition
Master over 170 recipes that will help you turn QGIS from a desktop GIS tool into …
book
ArcPy and ArcGIS – Geospatial Analysis with Python
Use the ArcPy module to automate the analysis and mapping of geospatial data in ArcGIS In …