In [1]:
import json
import urllib2
In [2]:
serviceURL='http://gis.sam.usace.army.mil/server/rest/services/JALBTCX/NCMP_BareEarth_1m/ImageServer'
In [13]:
# Get general image service info: Spatial reference, Pixel Type, etc
def getISinfo(serviceURL):
try:
# Sending request for general service info
post_data = ""
headers = {}
headers["Content-Type"] = "application/x-www-form-urlencoded"
serviceURL = serviceURL.replace("arcgis/services", "arcgis/rest/services")+"?f=json"
# Send general server request
req = urllib2.Request(serviceURL, post_data, headers)
response_stream = urllib2.urlopen(req)
response = response_stream.read()
jsondict = json.loads(response)
isprj = jsondict["extent"]["spatialReference"]
pixtype = jsondict["pixelType"]
defaultrr = jsondict["rasterFunctionInfos"][0]["name"]
return isprj, pixtype, defaultrr
except Exception,e:
print str(e)
In [14]:
isprj, pixtype, defaultrr = getISinfo(serviceURL)
In [ ]:
print isprj
print pixtype
print defaultrr
In [5]:
serviceURL
Out[5]:
In [ ]: