[gdal-dev] WMTS gdal_translate vs RasterIO

Michał Kowalczuk michkowalczuk at gmail.com
Thu Aug 29 02:00:53 PDT 2024


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
<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/0c675d7e/attachment.htm>


More information about the gdal-dev mailing list