[gdal-dev] WMTS gdal_translate vs RasterIO

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Thu Aug 29 03:08:09 PDT 2024


Hi,

For some reason, your code generates a request that is pointing to another tilematrixset. Gdal_translate is using "GoogleMapsCompatible" but with your code the "default028mm" gets used. Comparison does not make sense before you get both requests to use the same tilemetrixset.

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta Michal Kowalczuk via gdal-dev
Lähetetty: torstai 29. elokuuta 2024 12.01
Vastaanottaja: gdal-dev at lists.osgeo.org
Aihe: [gdal-dev] WMTS gdal_translate vs RasterIO

Hi once again!
I came across another problem using WMTS.
The following translate command:
gdal_translate -srcwin 0 0 1073741760 1553779 -outsize 691 1 "WMTS:https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/1.0.0/WMTSCapabilities.xml,layer=USGSHydroCached,tilematrixset=GoogleMapsCompatible" tile.png
passes with no errors.
.
If I use similar invoke of GDALRasterIO from C API I get the following error:
ERROR 5: WMTSCapabilities.xml,layer=USGSImageryOnly,tilematrixset=default028mm: Access window out of range in RasterIO().  Requested (0,0) of size 1073741760x1553779 on raster of 1073741756x1347126255.

The GDALRasterIO function call looks like this. I'm quite sure of its correctness, because it gives good results for the rest of tested WMTS services
GDALDatasetRasterIO(
handle_to_wmts_subdataset,
eRWFlag=GF_Read,
nXOff=0,
nYOff=0,
nXSize=1073741760,
nYSize=1553779,
pBuffer - buffer for data,
nBufXSize=1,
nBufYSize=691,
eBufType=GDT_Byte,
nBandCount=4,
panBandMap=[bIndex ,gIndex, rIndex, aIndex],
nPixelSpace=4,
nLineSpace=0,
nBandSpace=1)

Can anyone explain me hot to interpret the mentioned error:
Requested (0,0) of size 1073741760x1553779 on raster of 1073741756x1347126255?

Thanks!
Michał


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240829/f3a48af9/attachment-0001.htm>


More information about the gdal-dev mailing list