OWSLib icon indicating copy to clipboard operation
OWSLib copied to clipboard

WMS 1.3.0 ScaleHint

Open RGregat opened this issue 6 years ago • 1 comments

Hi propably there is a little bug at this line https://github.com/geopython/OWSLib/blob/master/owslib/map/wms130.py#L507

The way how the scale is currently read, is based on the WMS 1.1.1 specification. According to the official OGC WMS 1.3.0 specification http://portal.opengeospatial.org/files/?artifact_id=14416 on page 27 the scale is now represented by two XML-Tags <MinScaleDenominator> and <MaxScaleDenominator>. Someone already added a testcase where the MaxScaleDenominator exists https://github.com/geopython/OWSLib/blob/master/tests/resources/wms_dov_getcapabilities_130.xml.

So this

sh = elem.find(nspath('ScaleHint', WMS_NAMESPACE))
        self.scaleHint = None
        if sh is not None:
            if 'min' in sh.attrib and 'max' in sh.attrib:
self.scaleHint = {'min': sh.attrib['min'], 'max': sh.attrib['max']}

might be changed to

minScale = elem.find(nspath('MinScaleDenominator', WMS_NAMESPACE))
maxScale = elem.find(nspath('MaxScaleDenominator', WMS_NAMESPACE))
self.scaleHint = None

min = minScale if minScale is not None else 1
max = maxScale if maxScale is not None else None

if max is not None:
   self.scaleHint = {'min': min, 'max': max}

RGregat avatar Jun 26 '18 14:06 RGregat

+1

pelord avatar Mar 13 '19 18:03 pelord