Why you need the ArcGIS API for Python in your life…

25th August 2017

Chances are that you have landed upon this blog post either by accident, or due to an interest in the ArcGIS API for Python. Regardless, welcome to the Python party!! First things first, this is a (relatively) new pythonic API from Esri, not a rebranded version of arcpy!

Seeing as you mentioned it, what about arcpy then?

Everyone knows arcpy. arcpy is good at what it does on a desktop environment and isn’t going away. Increasingly though, our technology and users are migrating to web based solutions, rather than the traditional Desktop only GIS solutions and systems. So ArcGIS API for Python isn’t some new refactored arcpy pretender, rather it’s a web GIS integrator for arcpy and other Python 3 packages.

For the first time you can run arcpy (through ArcGIS Pro) alongside new ArcGIS API for Python functions to administer and analyse ArcGIS Online or your ArcGIS Enterprise solution, in a single Python 3 environment. Think of the ArcGIS API for Python as the unifying technology of the stack.

ArcGIS API for Python architecture and usage

The arcgis package (representative of the generic GIS model) is organized into a number of different modules that makes it simple to use and understand. Each module has a handful of types and functions that are focused towards one aspect of the GIS. The diagram below depicts the modules currently present in the API.

The gis module is the most important and provides the entry point into the GIS. The modules in green are used to access the various spatial capabilities or geographic datasets in the GIS. The modules in blue provide additional functionality for your workflows. The modules in orange visualise GIS data and analyses.

What can it do?

It can do some seriously cool stuff, given the relative immaturity of the API. Within Esri UK it has been used to process the large volume of schools that have signed up to the free ArcGIS Online for schools initiative. Additionally, the API can be used to; clone items from a Portal/ArcGIS Online, scrape and publish new data, analyse flood events, manage forest fire response, spatial big data analytics etc. etc. etc. .

There are samples here to whet your appetite. The samples can be run in a sandbox environment (Try it live) or downloaded for running locally, so you can get a feel for the API and what it is capable of. Most samples are in the form of a Jupyter Notebook.

Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. It provides an environment where you can run Python code in an interactive manner and visualize the output as maps and charts.

For me, Jupyter Notebook is a game-changer. It provides an interactive user-centric experience that you simply don’t get when compiling through an IDE. I believe it leads to a more focused analysis and understanding than you would get from simply running/compiling a script. It is a fantastic environment for bridging the gap between developers and analysts. It will force developers to write better, more efficient code; while introducing the logic of written code to analysts who may be unfamiliar with coding patterns.

How do I get it?

There are multiple ways to set up the ArcGIS API for Python. You can install via conda, ArcGIS Pro or Docker image. See here for further instructions on each of these installation methods.

Jupyter Notebook comes bundled with conda. Further details on using Jupyter Notebook with the API can be found here.

This has been a quick high level overview of ArcGIS API for Python. The API homepage is the ideal place to get started. It’s a fantastic addition to the Esri platform and we look forward to hearing how it is being utilised as it gains in prominence within the platform. Exciting times ahead!