On mardi 29 novembre 2016 11:49:36 CET Rahkonen Jukka (MML) wrote: > With a little help GDAL picks up correct extent. Removing the erroneous > WGS84BoundingBox hint from GetCapabilities made it. > > I consider that there is a bug in the WMTS server which is advertising > invalid bounding box but I don't really know GDAL should do. I am not good > at reading the code from > https://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/wmts/wmtsdataset.cpp > but I do see that there are comments about making a clip with the implied > bounding box of the most precise tile matrix, taking into account the > TileMatrix limits if they appear in GetCapabilities > > The logic seems to be now > > > 1) Use the BoundingBox of the layer expressed in the SRS of the tile > matrix set if that exists (row 1394) > > 2) Otherwise use the BoundingBox of the layer expressed in some other > SRS (for example WGS84) if that exists (row 1506) > > 3) Otherwise use the BoundingBox of the tile matrix set if that exists > (row 1550) > > 4) Otherwise compute the bounding box from the definition of the most > precise tile matrix (1558) > > The comments about clipping are on rows 1572 and 1587. > > So if the meaning was to take the advertised bounding box and clip it with > the box that is computed from the tile matrix set and its limits, it seems > to fail with our data > > In our case the layer has this faulty > <ows:WGS84BoundingBox> > <ows:LowerCorner>-6.38153862706 55.6179644952</ows:LowerCorner> > <ows:UpperCorner>60.3815386271 75.5825702342</ows:UpperCorner> > </ows:WGS84BoundingBox> > > and our most precise TM is > <TileMatrix> > <ows:Identifier>13</ows:Identifier> > <ScaleDenominator>3571.42857143</ScaleDenominator> > <TopLeftCorner>-548576.0 8388608.0</TopLeftCorner> > <TileWidth>256</TileWidth> > <TileHeight>256</TileHeight> > <MatrixWidth>8192</MatrixWidth> > <MatrixHeight>8192</MatrixHeight> > </TileMatrix> > > With WGS84BoundingBox GDAL finds > <DataWindow> > <UpperLeftX>-1553364.000000402</UpperLeftX> > <UpperLeftY>8388608</UpperLeftY> > <LowerRightX>2553364.000001241</LowerRightX> > <LowerRightY>6681097.999999317</LowerRightY> > </DataWindow> > > and without WGS84BoundingBox the correct > <DataWindow> > <UpperLeftX>-548576</UpperLeftX> > <UpperLeftY>8388608</UpperLeftY> > <LowerRightX>1548576</LowerRightX> > <LowerRightY>6291456</LowerRightY> > </DataWindow>
OK, I managed to reproduce with your above elements. I've pushed a fix so that in that case the WGS84BoundingBox is just ignored and the most precise tile matrix used. Even -- Spatialys - Geospatial professional services http://www.spatialys.com
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev