Skip to content

Instantly share code, notes, and snippets.

@amarinelli
Created November 16, 2014 16:51
Show Gist options
  • Save amarinelli/ea3d6fc4c69cc7ec59c6 to your computer and use it in GitHub Desktop.
Save amarinelli/ea3d6fc4c69cc7ec59c6 to your computer and use it in GitHub Desktop.
List the layers in an AGS map service using the REST endpoint
import urllib2
import json
content = urllib2.urlopen("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/layers?f=pjson").read()
service = json.loads(content)
for layer in service['layers']:
print layer['name'], ":", layer['type']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment