How do I work with the xml Element Tree to obtain the ScaleDenominator parent where ows:Identifier = default028mm?
With a fair bit of swearing I have managed to hack my way into all of the WMTS Scale's, I noticed that the OGC ones list first, I've taken advantage of this. But I want to do it properly and read the OGC Scales only. Alas, I've hit a brick wall. Any ideas?
import arcpy
import urllib
import xml.etree.ElementTree as et
WMTS = urllib.urlopen("http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/WMTS/1.0.0/WMTSCapabilities.xml")
print "Started"
import xml.etree.ElementTree as et
tree = et.parse(WMTS,parser=None)
root = tree.getroot()
test = 0
MaxScale = 600000 #600K No Scales Above
for ScaleDenominator in root.iter('{http://www.opengis.net/wmts/1.0}ScaleDenominator'):
Scale = float(ScaleDenominator.text)
ScaleCon = ((Scale/90.7144671432)*95.9999999999)
print 'WMST: ', ScaleDenominator.text
print 'Esri: ', ScaleCon
if test == 0:
test = (ScaleCon+1)
if test > ScaleCon:
print 'OGC028:', ScaleCon
test = (ScaleCon+1)
if ScaleCon < MaxScale:
print '< OGC028:', ScaleCon
WMTS XML: National Map USGS Topo WMTS XML
Aucun commentaire:
Enregistrer un commentaire