Review of GIS Tutorial for Python Scripting

Review of GIS Tutorial for Python Scripting

By David W. Allen.

Esri Press, 2014.

276 pages. $70.00, softcover.

ISBN: 978-1589483569

Review by: Adam P. Dixon, World Wildlife Fund & University of Maryland, Baltimore County

GIS Tutorial for Python Scripting

The newest book from Esri Press on Python scripting, GIS Tutorial for Python Scripting, is a hands-on walk-through of the many capabilities available within ArcGIS for Desktop which can be programmed using Python. Esri has recognized since the beginning that the world of geographic analysis cannot be contained within a GUI interface and has made some laudable strides in combining the graphical with scripting to allow analysts optimal utility of their software. The purpose of the book is to showcase the integration of Python within the ArcGIS desktop interface and to teach Python from this perspective. It is pleasantly written, with a can-do attitude that relentlessly implores the reader to apply his or her problem-solving skills through twenty-three tutorials ranging from basic manipulation of attribute tables to creating custom tools. Tutorials, exercises, and sample data are all based on theoretical needs of a municipal GIS manager. The author, David Allen, is the GIS manager for the city of Euless, Texas, part of the megalopolis of Dallas-Fort Worth.

The book’s five chapters total 255 pages in length, followed by 21 pages of appendices. Chapters are divided into tutorials that address overarching concepts of Python in ArcGIS. The chapters begin with using Python in labeling and field calculations, move through stand-alone Python scripting (covering cursors and loops allowing advanced access to data), then on to the mapping module (convenient for map automation), and end with creating ArcGIS toolboxes and Python add-ins. The stand-alone scripting chapter—arguably the most useful—contains nine tutorials, while the mode of the other four chapters is three tutorials. Each tutorial begins with a short explanation of the topic at hand (formatting labels, loops, cursors, while statements, etc.) and then dives right in to typical challenges at a suburban municipal GIS office. One tutorial covers the calculation of the flow rate of wastewater through the city’s sewer system, where the variety of underground pipe sizes and pipe materials necessitates a set of if-else statements within the field calculator of the ArcGIS attribute table. Another tutorial takes the reader through the steps needed to create lists of all the single-family and multi-family structures within the fire department’s response zones and to use the list to output a set of PDF maps for the fire department manager. Following each tutorial is an exercise based uponin which the user practices the concept with a similar but different question. Most of the code from the tutorials can be applied within the exercises as the new concepts are reinforced through repetition and referencing the previous tutorial steps.

GIS Tutorial for Python Scripting was copyrighted in 2014, and written for ArcGIS 10.2. The current version of ArcGIS at the time of this writing is 10.3. You will absolutely need an ArcGIS license to use the book to learn Python. I actually used 10.2.2 throughout my read of the book, and found that it generally worked, but did run into some problems that could not be resolved. Since basic principles of Python and the desktop environment generally stay more constant, I would advise readers up to five years in the future just to downgrade to ArcGIS 10.2 to complete the tutorials, and then to upgrade back to the current version upon completion. I imagine after five years from now, this book will be obsolete.

GIS Tutorial for Python Scripting is well written. The author’s pedagogical theory is that hands-on problem solving leads to thorough absorption of the information. This is generally true, but he wasn’t completely successful at giving all the tools and information needed to complete the exercises, thus eliciting unnecessary frustration. Which brings me to my next complaint: the book felt cheap. Esri Press books as a rule do not have the best printing or paper quality. It is no doubt a little silly to spend resources on books about ArcGIS 10.2 when ArcGIS 10.3 and so on will be available soon thus casting the information into obsolescence in a frighteningly short amount of time. Regardless, the cheapness of the book, and more importantly the lack of attention to detail in the formatting lead to further frustrating moments, especially if you are unaware that a literal reading of the book is not always advised. It is hard to advise against character-for-character literalism when Python programing syntax is case and character sensitive; an errant space or apostrophe can take a frustratingly long time to discover. But that is indeed the case. The user of the book must do the best he or she can to get through it and leave it at that.

Using the book to teach Python programming to a group of students might really make this book shine. Minor errors in the book could be quickly discovered by a Python expert teacher and immediately resolved. Further, the content matter and pace of the exercises are perfectly suited for the brief and concentrated sessions that make up a semester. Frustration must be the greatest barrier to entry to programming. If the user cannot find a solution within the programming syntax, he or she is doomed, and thus a person like a lab assistant to ask questions is a godsend. Without assistance, determined persistence is the only resolver of intractable programming errors. One of the unspoken lessons of the book (and learning to program in general) is that with practice, identifying and resolving errors becomes easier, but begins as a seemingly wide river with a strong current to swim. Which brings us back to the qualities of this book. It could use a touch of mercy, especially for the solo practitioner. The independent Python tutee, with only the book as his or her guide, will have problems. Each tutorial walks the reader through the steps in a concisely explanatory manner. There were multiple times however, the tutorial was precisely followed and the final script refused to function as warranted by the recipe, due to formatting errors or typos wreaking havoc on Python’s exacting syntax. A flawlessly formatted programming book might not exist. But the design of each tutorial could be vastly improved by including the full code employed during the session at the end for reference (or at least put it in an appendix or online). As it is, the code is chopped into pieces throughout the tutorial and piecing it together can be confusing. The can-do attitude and problem solving virtues of the book begin to seem foolish and bring only misery when one spends hours on a tutorial only to give up because no solutions appear possible.

No mention is made of non-Esri applications where Python programming may be useful. Quantum GIS has a Python interface for instance, and it would have been good to know how these interact. GDAL utilities are also accessible with Python. A new Python library called Pygeoprocessing has been developed by developers at the Natural Capital Project (goo.gl/4Obalz). I am just touching the surface of all the geographic Python tools out in the world. It is not surprising that an Esri book does not contain these concepts but a nod in the name of collegiality would have been nice.

GIS Tutorial for Python Scripting is sold throughby Esri for $70.00 and comes with all the sample data required. If you use ArcGIS at your workplace and are in the market for Python tutorial material, this is a good buy. You’ll have a guided tour of the use of Python and understand the full set of the impressive capabilities available to you in ArcGIS. You should expect to spend quite of bit of time to complete the book. I was slightly beyond a newbie in Python prior to undergoing this exercise and spent at least fifty hours getting through all of the materials. Some of the tutorials take longer than the others, but in general they take about two hours or more when you include the exercise.

The book is thus at best a wonderful curated tour of Python use in the proprietary GIS software package, and at worst a plodding and frustrating exercise in teaching oneself how to program. The spectrum of your experience navigating through the book will certainly touch these highs and lows, although the exercise in totality did seem worth it. Having completed the tutorials I’ll be able to approach Python in a much more creative and constructive manner in my daily work, and I’m now able to get started with more confidence on a programming project I’ve had on the back burner. I felt like the first three chapters were much more important than the final two, which dealt with ArcGIS toolbox and toolbar creation. These felt more like an ArcGIS tutorial than a Python one. If you are a teacher, you might find this set of tutorials a great walk through the many typical activities your students will encounter as GIS professionals. The self-study aspects of the book (especially the first three chapters) would complement a larger syllabus covering the Python universe.

Refbacks

  • There are currently no refbacks.