Dueling Book Reviews: Python Scripting for ArcGIS

July 25, 2013
Share

Sharing is Caring

Python Scripting for ArcGIS 
Paul A Zandbergen, ESRI Press, 2013
ISBN: 9781589482821    2013   368 pages   $79.95

Book Review by Greg Newkirk, GIS Manager, Fremont County, Idaho
Adjunct Faculty, Brigham Young University – Idaho

Generally I do not look forward to reading textbooks, and Paul Zandbergen’s Python Scripting for ArcGIS is exactly that: a textbook. It is the kind of book that is printed in hardback by the big publishers. But ESRI Press has created a sturdy paperback volume that is favorably priced either for the self-learner or the classroom student. The most persuading aspect is that Zandbergen, a college instructor with a solid grasp of classroom learning, has crafted a classic textbook that is complete with a CD-ROM full of labs, instructions and data. 

Zandbergen assumes that the reader has a solid background in ArcGIS with little or no background in programming. He begins with four chapters on Python and geoprocessing basics including a discussion on Model Builder and batch processing before explaining their limits for automation and the need for Python. Throughout the book Zandbergen provides a solid foundation, covering all the essentials. There are a few snippets of code used for instructive purposes, which are adequate to teach necessary principles and programming techniques. But anyone looking for a library of ready-made solutions will be disappointed. Clearly, the intent of this book is to teach the basic logic of writing code and specific techniques for automating geoprocessing tasks. It is well-designed to foster confidence in the learner who will by the end of the book have a solid grasp of the basics.

Zandbergen takes the reader step by step through all the essential aspects of writing code, introducing the ArcPy site package along with tools, toolboxes, functions, classes and environmental settings as an integral part of the process. It is not until chapter six that the reader first learns how to automate a task by generating a list and looping through it. This might seem frustrating for some readers to move through the material at this pace, but Zandbergen is well aware that the inexperienced programmer might start firing off snippets of code that can send a computer into an infinite loop.

The book continues at the same pace throughout all the chapters, covering the essential elements of arcpy.da, arcpy.sa and more. Even when the text arrives at arcpy.mapping, the reader is held to the same pace of learning. Each chapter painstakingly teaches the basics, reinforcing them with demonstrations of code. Finally, in the last two chapters the reader learns how to make and share tools, which launches the reader on a creative course of writing code in small useful encapsulations. This is where a solid understanding of all the basics pays off. The reader is more than ready to start writing code and can practice by creating small automation tools. 

Many years ago when ESRI introduced ArcMap, coding became largely unnecessary to operate a GIS. The old days of programming in AML vanished away, but the need for automation remained. Model Builder helped, and ESRI’s introduction of Python scripting restored some of what was lost, but the ArcPy Site Package and education materials demonstrating how to use it were still evolving. Now with Zandbergen’s Python Scripting for ArcGIS the non-programming practitioner once again has a solid footing to perform tasks that require some kind of coding, and the college instructor has a much needed text for introducing college students to scripting in the geoprocessing world. 

Python Scripting for ArcGIS
Paul A Zandbergen, ESRI Press, 2013
Book review by Alicia C Newberry, GIS Analyst, City of Woodstock, GA

As someone who is a novice to Python and programming, I was very glad to see Paul Zandbergen’s Python Scripting for ArcGIS released earlier this year. In the past, I had referenced other introductory Python texts and standalone tutorials, but had not been able to find a comprehensive volume that dealt specifically with Python in ArcGIS. This new book from Esri Press fills that informational gap very well and offers a solid introduction to Python and the ArcPy site package. 

This book is intended for established ArcGIS users who are interested in learning about scripting and automation of tasks. The author suggests that some programming background is useful, but not required, as the book is primarily written with the inexperienced coder in mind. Personally, it was helpful for me to be familiar with Python syntax, as the author does not cover it until chapter 4, and some basic programming logic. It is worth noting that this book is written for ArcGIS version 10.1, as the code and exercises will require the ArcPy site package that became available with the version 10 release. A 180 day trial version of ArcGIS for Desktop 10.1 comes with the book for those who may not have access to the software or extensions, such as Spatial Analyst, that are used in the exercises.

The text is organized into four sections, covering a total of 14 chapters, with each chapter including a corresponding exercise. The first section introduces the Python language and covers basic geoprocessing, as well as an introduction to PythonWin and the interactive Python window in ArcGIS. In chapter 4, we finally are introduced to the fundamentals of the Python language, including proper syntax. The second section is the real core of the book where the reader is introduced to the ArcPy site package and then has the opportunity to practice exploring and manipulating spatial data using Python scripting. Section 3 delves into more specialized tasks, such as automating the exporting and printing of maps, fixing broken data sources, debugging and error handling, and creating Python functions and classes. The book wraps up with two chapters on creating and sharing custom tools.

Each chapter’s concepts and code build on the previous chapters, and the exercises enforce the concepts learned. Unfortunately, some of the exercises were just mirrors of the examples discussed in the book, particularly in the first few chapters, so these didn’t feel as informative or useful. An unavoidable issue of many of the exercises involved working back and forth between ArcMap and PythonWin. Because ArcMap puts locks on data and some scripts are not able to run successfully with both programs open, the user is frequently called upon to open and close them, which can be frustrating with ArcMap’s slower load time. One of the things that I truly appreciated about this book was the opportunity to work on the ‘Challenge’ exercises at the end of each chapter exercise. These really got me thinking and doing, which helped me learn more effectively than just reading and following step-by-step instructions.

Overall, Python Scripting for ArcGIS is a thorough introduction to using Python in ArcGIS and a great way to start learning how to automate the sometimes tedious geoprocessing tasks that we are all called upon to do. This book would be a fantastic addition to any GIS professionals’ bookshelf.

Reprinted, with permission from The GIS Professional May/June 2013.

Share

Sharing is Caring


Geospatial Newsletters

Keep up to date with the latest geospatial trends!

Sign up

Search DM

Get Directions Magazine delivered to you
Please enter a valid email address
Please let us know that you're not a robot by using reCAPTCHA.
Sorry, there was a problem submitting your sign up request. Please try again or email editors@directionsmag.com

Thank You! We'll email you to verify your address.

In order to complete the subscription process, simply check your inbox and click on the link in the email we have just sent you. If it is not there, please check your junk mail folder.

Thank you!

It looks like you're already subscribed.

If you still experience difficulties subscribing to our newsletters, please contact us at editors@directionsmag.com