Getting layer information with the ArcGIS REST API and Python
A map service resource contains datasets that can include tables or layers. It contains basic information about a service, including feature layers, tables, and service descriptions. In this recipe, you will learn how to return layer information from a map service, using Python and the ArcGIS REST API.
Getting ready
To get information about a specific layer in a map service, you will need to reference the index number that is associated with the layer. When you examine the Services Directory page for a service, you will find a list of layers that are part of the map service along with index numbers for each layer. The index numbers are used instead of the layer name when requesting information about a layer. As we've done in the past few recipes, we'll use the Python requests
module to make the request and process the response.
How to do it…
Follow these steps to learn how to get information about a layer from a map service:
In IDLE...