Python API for ArcGIS Updates

This blog post covers some recent updates on the Python API for ArcGIS.

The Python API for ArcGIS is targeted at ArcGIS Online and ArcGIS Enterprise users, analysts, developers and administrators. It helps them to script and automate a variety of tasks, such as performing big data analysis to content management and administration of web GIS. Since its first beta release in December 2016, there have been some updates, the most recent one dating from July 2017 and marking the 1.2.0 release. While the online API documentation lists a number of enhancements for each update, the list is not complete, reason to assume that there´s still a lot of work to be done on the side of Esri in order to offer an API with all the capabilities Esri announced with the initial release.

Updating to the latest API version

With the current version being 1.2.0, users using an earlier version might want to update their API. If you´re using Conda, you need to use the following command in a command prompt or terminal:

conda upgrade -c esri arcgis

Please note that the “-c” command refers to an online channel, which means you´re telling conda it needs to update the API through the channel where the API can be downloaded. If you try to update your root directory with Python packages, your current API won´t be updated automically to a new version. Conda uses the command “upgrade” instead of “update”, that is used with pip install. New users can simply download the API by typing the following command inside a terminal:

conda install -c esri arcgis

Current API structure

The API is divided into 13 Python modules that contain classes, functions, and types for managing and working with elements of the ArcGIS platform information model. If you´re new to this API, you might want to spend some time getting to know the different modules, tools, classed and methods. This is because since its first release, functionality has been moved around and assigned to different modules. What has not changed with version 1.2.0 is that there are still 13 base modules, with new functionality added into submodules of these base modules.

GIS analysis: not the same as with ArcMap or Pro

GIS analystis coming from ArcMap or Pro have some work to do in getting to know the API. For example, they have no less than six modules at their disposal for accessing the various spatial capabilities or geographic datasets. The fact that there so many modules doesn´t make it easier to use though: for example, the API distinguishes between geoprocessing and geoanalytical tools, but a tool may belong to both categories at the same time.

Modules that offer extended functionality such as geoprocessing tools, as well as separate modules for data visualization and analysis have not been derived from ArcMap or Pro, so you will need some hands-on experience to get acquainted with the API’s design logic. There are also some differences as to working with this API compared to arcpy. For example, before you can apply a tool, you need to search for it within ArcGIS Online and load it first. The same goes for adding data to a map: whereas arcpy (run inside of ArcMap) automatically would add data after analysis to a map, you have to do this yourself through a separate command. If you do this through a Jupyter Notebook (which is the recommended environment to use the API), your data will be added to an earlier code cell where your map was first called, which means you have to scroll up or create another map window within a notebook.

Enhancements in the 1.2.0 release

Looking at recent 1.2.0 release, there are a number of new capabilities in the form of submodules which means that there´s more functionality added at a lower hierarchival level. A new map widget that disables zoom when scrolling the notebook is very much appreciated. For an upcoming version, Esri might want to consider an option to filter search results for geoprocessing tools based on the quality of these tools rather than only limit the amount of returned results. Esri offers ample online documentation for the API: there´s a website with an official documentation page, an API reference and an updated set of sample notebooks.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.