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-boun...@lists.osgeo.org> Puolesta Michal Kowalczuk via gdal-dev Lähetetty: torstai 29. elokuuta 2024 12.01 Vastaanottaja: gdal-dev@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ł
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev