First Impressions of the ArcGIS API for Python

Esri´s ArcGIS API for Python provides GIS users with a Python API for their Web GIS, whether that´s ArcGIS Online, ArcGIS Portal or ArcGIS Enterprise in the cloud. Esri describes the API as “a powerful, modern and easy to use Pythonic library to perform GIS visualization and analysis, spatial data management and GIS system administration tasks that can run both interactively, and using scripts”. Here are some random impressions after some hands-on experience.

The API is (partly) targeted at a non-GIS audience

The online documentation of the API indicates that Esri intends to reach a whole new audience with this API: one that is not familiar with desktop-based GIS, but does know Python programming. This audience probably won´t have a background in desktop-based GIS but might be interested in the GIS technology. The API offers them a handy tool to get started, as you only need to install it through a single command line and can get started right away using it, as no login credentials are required to use ArcGIS Online. This way, it can function as a low-barrier entry into Esri´s ArcGIS platform.

Like what you’re reading?
Subscribe now and receive the full version of our newsletter delivered to your inbox each week.

Email address:

The API was designed with different user groups in mind

Whereas Esri´s arcpy site package reflected the geoprocessing tools of ArcMap and ArcGIS Pro, this API was designed with different users groups in mind. Esri distinguishes various user personas that can benefit from using the API, such as administrators , content publishers, analysts or developers. For example, administrators can use the API to populate a portal with users, groups, content, manage roles in their organization, or clone a portal, while analysts can use its spatial analysis, imagery, geocoding, geoprocessing, geometry or new big data raster analytics tools. These tools can be searched and called interactively in a Jupyter Notebook kernel using Python commands, just like you would use an interactive interpreter. Search results are returned through a connection to ArcGIS Online.

The API works really well within a Jupyter Notebook

Jupyter Notebooks have a lot of nice features that make them suitable for working with Python code, data frames, images, markdown and more. One very nice feature of the API is a map widget that is built on top of the ArcGIS JavaScript API. This widget allows you to embed maps in the notebook. These can be used as a background map on which you can overlay content from ArcGIS Online, or perform data analysis and have the results shown on that same map. 2D and 3D Esri maps can be combined with charts and graphs and shared with others by providing a copy of the whole workflow, data and results inside one notebook. As such, Jupyter notebooks offer more flexibility and layout options than a single Python script in an IDE.

Like what you’re reading?
Subscribe now and receive the full version of our newsletter delivered to your inbox each week.

Email address:

It is indeed a Pythonic API

The API documentation states that the API “provides a pythonic representation of a GIS”. This means that it corresponds to “Python best practices in its design and uses standard Python constructs and data structures with clean, readable idioms.” This is not an empty promise: when consulting the API documentation, you will recognize many good practices with regard to the code, which is a lot closer to “pure” Python than ArcPy ever was.

This is partly because the API uses Python 3.5 and 3.6, meaning Python version 3 instead of 2. Many developers have expressed their preference for Python 3 over version 2, which contained inconsistencies under the hood. ArcPy solved these inconsistencies very well, but if you´re an experienced Python developer without any previous GIS experience, you will benefit from using the API as it is not tied to a specific GIS application with its own logic that is reflected in the corresponding Python site package. For example, the API documentation shows code examples with regards to error handling that resemble how generic error handling in Python is dealt with.

Eric van Rees is a freelance writer and editor. His specialty is GIS technology. He has more than eight years of proven expertise in editing, writing and interviewing as editor and editor-in-chief for the international geospatial publication GeoInformatics, as well as GIS Magazine and CAD Magazine, both published in Dutch. Currently, he writes about geospatial technology for various clients, publications and blogs.