
Foreword
I have long preached the importance of GIS programming, and students who have listened have done well and not spent all of their time clicking their way through their work. They've also gotten good jobs and interesting careers. However, learning GIS programming needs resources, and while there are a lot of clues on websites and you can certainly learn programming languages such as Python in places like CodeAcademy, there's a lot more to GIS programming, and understanding some of the complexities of accessing spatial data and processing requires a systematic approach. This new edition of ArcPy and ArcGIS: Geospatial Analysis with Python by Silas Toms and Dara O'Beirne is one such approach and it provides a significant contribution, extending from desktop to online GIS methods.
Toms and O'Beirne take the approach of jumping right into the deep end and exploring the water, or as I'd prefer and the original cover illustration suggests, jumping in and exploring a mountain river. This approach is particularly useful for those of us who already have some experience with programming and just need some clues about how to work in this particular pool and find its eddies and falls. You can spend an entire book learning about the Python language, and while that can be valuable, who has the time?
There's a lot to the ArcPy part of Python scripting; a lot more than the language itself. ArcPy scripting is very much a high-level scripting approach, but the stuff you interact with has considerable depth. You need to understand how to use the geoprocessing tools, ArcPy methods and properties, spatial data relationships, and many other structures. So reasonably, this book focuses on the ArcPy part and takes the user all the way to online GIS automation, which depends more on knowing how to find and structure things than knowing how to code.
Learning about cursors in Chapter 3, ArcPy Cursors - Search, Insert, and Update, and geometries in Chapter 4, ArcPy Geometry Objects and Cursors, gets right to the heart of the value of Python scripting in ArcGIS. The most useful ArcPy scripts I've ever used or written have used cursors, mostly accessing and creating geometries. This is where you really see the benefit of a scripting model, and you can write tools that can do things that are impossible (or at least impractical; I guess you can edit each feature one at a time) without a script.
Continuing in the deep river pool mode—gets your heart racing—we start building script tools in Chapter 5, Creating a Script Tool! Now when I write scripts, I tend to have to fight my way through bugs—I'm a bit of an empirical programmer—so I tend to first get my code working with hardcoded data in the IDE at the script tool stage. At the script tool stage, arcpy.AddMessage becomes my typical debugging tool, serving as the venerable print statement, something like arcpy.AddMessage ("Just finished the data conversion loop"). However, while many readers may want to follow my approach, building a working script tool in Chapter 5, Creating a Script Tool, lets you see where you can get pretty quickly.
Many GIS users are working in agencies dealing with managing lands or infrastructure, and with this type of responsibility, building maps is a foremost concern. The chapter on the Arcpy.mapping module is especially welcome, because we don't just need to automate our analysis, we also need to automate our maps for greater efficiency and consistency in the design.
The direction of GIS these days is certainly online, so the significant coverage of online methods in this edition, ranging from ArcGIS Online and REST services to the new ArcGIS API for Python, is welcome. While I've traditionally focused on desktop analytical methods, I plan to use this introduction to move some of our toolsets online. Finally, even we die-hard desktop users have learned that we need to move online at least enough to make good use of ArcGIS Pro, so this coverage is a welcome addition.
All in all, Toms and O'Beirne have certainly come up with a very useful text that certainly belongs on the shelf (or Kindle) of any prospective ArcGIS programmer who wants to jump in and start exploring the river. I will certainly use it myself and recommend it to my students and colleagues.
Jerry Davis
Geography Professor and Department Chair from San Francisco State University