I write a lot of spatial data analysis code using ArcGIS’s Python package, arcpy. Sometimes we need to automate map generation as part of that work, but with the split of the arcpy.mapping library between ArcMap and ArcGIS Pro, developers had to target two different APIs in order to make their code compatible with ArcMap (quickly becoming legacy) and ArcGIS Pro (not quite ready for prime-time yet). Esri diverged the two APIs for good reason – the mapping concepts in the two software packages vary and necessitate a new API. But for many, maybe even most, use cases, the concept is the same – work with a map, adding, removing, and symbolizing layers.

To address this for an internal project, I wrote a compatibility layer, called amaptor that creates its own API, and behind the scenes translates those API calls to the version of ArcGIS it’s running on. Code written for one version can thus be run on the other, saving programmers from multiple versions of software and endless repetitive checking of available features. In the process, I added some of my own basic enhancements that address common tasks, such as finding a layer in a map.

Amaptor includes API documentation and is available on PyPI/pip and GitHub.