Is there any better documentation available for the ArcGIS Python API anywhere? Not sure if it's just me but I find the current "api reference" almost impossible to use.
E.g. I want to get a layer object and use it. I click on the "Layer" link. It tells me how to get a layer, but nothing about the layer object I get. Are we supposed to jump across to some other unlinked documentation to find out what properties the layer object has? Or do we trawl through youtube videos of presentations or sample notebooks to piece together what to do?
Any help or better resources appreciated.
Yes. The documentation is not great.
Your best option to learn this API is to debug heavily using a good IDE and browse the objects. For an even better understanding you should 'step in’ the debugger into the API the scripts themselves.
Esri should really revamp efforts to improve documention on this API. Even the samples they provide are stale and old.
Having Notepad++ or similar text editor open can also be your friend since documentation within the scripts is sparse there and import and dependencies are often private methods. After a while you find out that things eventually lead back to Pro toolbox calls, stuff in arcgisscripting or numpy/pandas. For a lot of functionality, the Pro help files are applicable.
A handy tool if supported by your ide is to examine the code directly for whatever class/method you are interested in.
Here is an example using Spyder... line 1 the import ... line 3 the ?? marks to pull up the code for arcgis.gis.Layer
It just saves you navigating through the trail as to where the class is actually implemented.
Init signature: arcgis.gis.Layer(url, gis=None)
The layer is a primary concept for working with data in a GIS.
Users create, import, export, analyze, edit, and visualize layers.
Layers can be added to and visualized using maps. They act as inputs to and outputs from analysis tools.
Layers are created by publishing data to a GIS, and are exposed as a broader resource (Item) in the
GIS. Layer objects can be obtained through the layers attribute on layer Items in the GIS.
def __init__(self, url, gis=None):
super(Layer, self).__init__(url, gis)
self.filter = None
............ huge snip ..........................
The Using Feature Layers | ArcGIS for Developers section in the guide has documentation on the properties and how to access them. As the API works against several versions of ArcGIS Enterprise and ArcGIS Online, the specific properties are not hard-coded but dynamic depending upon the capabilities of the backend GIS you are working against.