I'm also finding Jake Skinner 's script helpful and I'm incorporating into the workflow I'm working on right now. To make it a little easier to read (and reuse), basically same info from line 14+ in script above. I'm just starting to use and see the power in the urllb and urllib2 modules (still a novice)
def listScaleLevels(mapServiceURL, token):
params = { 'f': 'json', 'token': token}
req = urllib2.Request(mapServiceURL, urllib.urlencode(params))
response = urllib2.urlopen(req)
data = json.load(response)
return(data['tileInfo']['lods'])
serviceTiles = listScaleLevels(mapServiceURL, token)
for cachescale in serviceTiles:
print(("{0}".format(cachescale)))
Would return a format similar to:
{u'scale': 16000000, u'resolution': 4233.341800016934, u'level': 0}
{u'scale': 8000000, u'resolution': 2116.670900008467, u'level': 1}
{u'scale': 4000000, u'resolution': 1058.3354500042335, u'level': 2}
{u'scale': 2000000, u'resolution': 529.1677250021168, u'level': 3}
{u'scale': 1000000, u'resolution': 264.5838625010584, u'level': 4}
{u'scale': 500000, u'resolution': 132.2919312505292, u'level': 5}
{u'scale': 250000, u'resolution': 66.1459656252646, u'level': 6}
{u'scale': 125000, u'resolution': 33.0729828126323, u'level': 7}
{u'scale': 63360, u'resolution': 16.764033528067056, u'level': 8}
{u'scale': 24000, u'resolution': 6.350012700025401, u'level': 9}