Created
November 16, 2014 16:51
-
-
Save amarinelli/ea3d6fc4c69cc7ec59c6 to your computer and use it in GitHub Desktop.
List the layers in an AGS map service using the REST endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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