Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Programming ArcGIS with Python Cookbook, Second Edition

You're reading from   Programming ArcGIS with Python Cookbook, Second Edition Over 85 hands-on recipes to teach you how to automate your ArcGIS for Desktop geoprocessing tasks using Python

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781785282898
Length 366 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Eric Pimpler Eric Pimpler
Author Profile Icon Eric Pimpler
Eric Pimpler
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Fundamentals of the Python Language for ArcGIS 2. Managing Map Documents and Layers FREE CHAPTER 3. Finding and Fixing Broken Data Links 4. Automating Map Production and Printing 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 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 13. Using Python with ArcGIS Pro A. Automating Python Scripts B. Five Python Recipes Every GIS Programmer Should Know Index

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text are shown as follows: "we have loaded the ListFeatureClasses.py script with IDLE."

A block of code is set as follows:

   import arcpy
   fc = "c:/ArcpyBook/data/TravisCounty/TravisCounty.shp"
   # Fetch each feature from the cursor and examine the extent # properties and spatial reference
   for row in arcpy.da.SearchCursor(fc, ["SHAPE@"]):
     # get the extent of the county boundary
     ext = row[0].extent
     # print out the bounding coordinates and spatial reference
     print("XMin: " + ext.XMin)
     print("XMax: " + ext.XMax)
     print("YMin: " + ext.YMin)
     print("YMax: " + ext.YMax)
     print("Spatial Reference: " + ext.spatialReference.name)

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

   import arcpy
   fc = "c:/data/city.gdb/streets"
   # For each row print the Object ID field, and use the SHAPE@AREA
   # token to access geometry properties
   with arcpy.da.SearchCursor(fc, ("OID@", "SHAPE@AREA")) as cursor:
     for row in cursor:
       print("Feature {0} has an area of {1}".format(row[0], row[1]))

Any command-line input or output is written as follows:

[<map layer u'City of Austin Bldg Permits'>, <map layer u'Hospitals'>, <map layer u'Schools'>, <map layer u'Streams'>, <map layer u'Streets'>, <map layer u'Streams_Buff'>, <map layer u'Floodplains'>, <map layeru'2000 Census Tracts'>, <map layer u'City Limits'>, <map layer u'Travis County'>]

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "go to Start | All Programs | ArcGIS | Python 2.7 | IDLE".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime