Meet the Product: Integrated Python Geoprocessing (pygp)
If you have worked with geoprocessing long enough, there has likely been a thing or two you have wanted to automate to lighten your workload. I mean, there are companies that are built on quick fix solutions to offer you just that. When it comes to programming for spatially-sound data though, don’t you deserve a similar approach?
Thankfully, this is where Integrated Python Geoprocessing comes in. Affectionately named pygp – pronounced like "pie" not "pig" – this solution is a Python library specifically designed for the geoprocessing framework. It is a package built internally, developed throughout the last few years, and constantly improving. Not only do we offer it as a solution for clients who wish to dig into the code themselves, but we also use it to build out the abundance of tools we offer here at Integrated. This pygp, man...it is no one-trick pony.
This library follows a well-established set of coding standards and best practices (e.g., idiomatic Python) that have evolved as the Python practitioner community has grown ever since the inception of the Python language. Because of this, pygp handles much of the heavy-lifting often placed on the developer. This is due to employment of multiple individual geoprocessing operations that have been combined into larger, logical (frequently used) operations to make them easier to both understand and apply.
To give an idea of the perks and benefits of this solution, a few key features are below.
Integrated Python Geoprocessing provides a framework for tools that allows them to continue to work when upgrading both minor and major releases of the ArcGIS platform.
By utilizing positional and keyword arguments within the library, sensible defaults may be used more often. Additionally, much less typing is required for otherwise empty arguments…and who doesn’t love less typing?
pygp enables the ability to nest multiple geoprocessing tools that would typically require being run within a sequence. This nesting produces essentially a single line of code for complex processes, allowing the sequence to behave more like true Python functions.
Since Spatial Reference objects are rich objects, they are easier to create, use, manipulate, retrieve, and compare by way of Integrated Python Geoprocessing.
Extended Data Elements
With the use of this package, Data Elements are treated as objects rather than exclusively as strings. This allows for the exposure of properties and methods on feature classes, rasters, datasets, tables, and virtually all other Data Elements associated with GIS.
Looping through the rows of a table requires a lot of repetitive code that is not particularly “Pythonic”. pygp cursors avoid this by making the cursors iterable and exposing them as methods on the extended data classes. These cursors also provide optional field and value validation.
With pygp, Map Documents can now be treated in an object-oriented manner, allowing easier integration as well as extension and use within applications.
As I mentioned earlier, this library is ever-evolving. Because we use it in-house, we are able to tweak and fine-tune it as we go, subsequently adding new features as they spring up in other projects. I mean, even Merriam Webster adds new words to the dictionary – Why should a Python library remain stale and out of touch?