Why and How to Learn ArcPy?
Many of the reasons to learn ArcPy have already been described in an earlier Learn Programming Academy Blog post named Three New Courses Released – ArcPy, Machine Learning with Python and HTML/CSS so here I’ll talk first about why and how I came to learn it.
I first encountered Geographic Information Systems (GIS) when working for the South Australian Museum on a project to computerize its mammal collection in 1985-1986. At the time I was entering field values for the species, collector, date, latitude and longitude of each specimen in the collection into a textual database and I wanted to use a map to visualize where each species came from. The project was jointly administered by the South Australian Department of Environment and Planning (SADEP) and they developed a button for the database’s GUI which drew a map for a species from its collection locations. The tool that they used to do this was a GIS software product named ARC/INFO from the Environmental Systems Research Institute (ESRI).
When the project finished I went to work for SADEP, and that started a transition from being a zoologist and occasional GIS user, who clicked a button to produce a map, to being a fulltime GIS developer for ESRI in the UK, a few years later. Your career in GIS developing will inevitably take a very different path to mine, and while I still very much advocate the use of Esri (as its name is now written) software, the products that you use today have undergone massive evolution and two major architectural revolutions.
In 1999, ArcGIS was released with its flagship application ArcMap and while that could be customized using Visual Basic for Applications (VBA) and ArcObjects from the outset, it was only about 10 years later that Python bindings for ArcObjects became available as a site-package named ArcPy. It was around 2010 that I started learning Python and ArcPy. While I had a steep learning curve on Python, I found ArcPy relatively easy to pick up because, from my many years as a proprietary AML (Arc Macro Language) developer, I came to it with a large vocabulary of ARC/INFO commands and parameters that readily mapped to the ArcPy functions and parameters.
In 2015, ArcGIS Pro was released as Esri’s next generation flagship application (designed to replace ArcMap over time), and even though ArcObjects no longer underpins that application, the most popular way to customize it is still by using Python with ArcPy. Once again the existing a large proportion of the existing ArcPy functions and parameters readily mapped to those of ArcGIS Pro, with the main exception being that the arcpy.mapping module that worked with ArcMap map documents had undergone a major overhaul to become the arcpy.mp module that works with ArcGIS Pro projects and maps.
If you are a Python developer, wanting to expand your skills into GIS, and are trying to decide which geospatial Python libraries to focus on, the way I measure their relative popularity is by counting the number of Q&As about them at the GIS Stack Exchange. As of writing the two most asked about geospatial Python libraries are ArcPy (7,791) and PyQGIS (3,738), followed distantly by pyproj (86), pyshp (71) and the rest.
If your Python skills are still nascent then, before embarking on ArcPy for Python Developers using ArcGIS Pro, you may want to commence the Complete Python Masterclass first, but if you don’t mind a steeper learning curve then jumping straight to the ArcPy course is certainly achievable.
As you undertake ArcPy for Python Developers using ArcGIS Pro, and after that, I strongly encourage you to reinforce what you have learned using two important resources:
- The ArcGIS Pro Python Reference in the ArcGIS Pro help; and
- ArcPy Q&As at the GIS Stack Exchange
ArcGIS Pro Python Reference
“The ArcGIS Pro Python Reference contains detailed information about every ArcPy module, function, and class provided with ArcGIS Pro, working with Python, as well as how to work with, and create your own, geoprocessing tools in Python.”
I frequently use this resource not just to check the syntax and parameter options for the various functions and classes but also because each provides one or more pieces of sample code for typical workflows that might involve it. You can think of this as being a somewhat static resource but, at each new release and often in between, more sample code is added, often in response to user requests.
GIS Stack Exchange
“Geographic Information Systems is a question and answer site for people interested in GIS, Remote Sensing, Photogrammetry, Geodesy and Surveying, as well as Programming/Databases specific to the aforementioned.”
This is a great resource for browsing to find whether an ArcPy programming question, which you think “someone must have asked before”, has already been asked, because often it has not only been asked but answered too! The site is far from static because if your question has not yet been asked, or maybe it has been asked but not answered (about 8% fall into this category), then you can work with the site’s ArcPy experts who volunteer their time to construct new Q&As by working on finding an answer to your question.
Conclusion
As a Python developer coming to ArcPy you are likely to find that your biggest challenge is not learning more core Python but instead will be building up a vocabulary of ArcPy spatial functions and workflows that enable you to communicate with, develop applications for, and delight ArcGIS Pro end users and spatial project stakeholders. The best place to learn about ArcGIS Pro and ArcPy is from someone who specializes in them, and who has specialized in customizing spatial products from Esri for over 30 years!