<div dir="ltr">Hi,<div>Consider the following WMTS service:<div><i>WMTS:<a href="https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/1.0.0/WMTSCapabilities.xml?SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0,layer=USGSHydroCached,tilematrixset=default028mm">https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/1.0.0/WMTSCapabilities.xml?SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0,layer=USGSHydroCached,tilematrixset=default028mm</a></i></div><div><br></div><div>and try to get whole extent:</div><div><b>gdal_translate -srcwin 0 0 1852166785 1511812353 -outsize 570 465 "WMTS:<a href="https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/1.0.0/WMTSCapabilities.xml?SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0,layer=USGSHydroCached,tilematrixset=default028mm">https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/1.0.0/WMTSCapabilities.xml?SERVICE=WMTS&REQUEST=GetCapabilities&VERSION=1.0.0,layer=USGSHydroCached,tilematrixset=default028mm</a>" tile.png --debug on --config GDAL_ENABLE_WMS_CACHE NO</b></div><div>(where 1852166785 1511812353  is a raster size)</div><div><br></div><div>GDAL creates 4 requests:</div><div><br></div><div><i>HTTP: Requesting [1/4] <a href="https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/tile/1.0.0/USGSHydroCached/default/default028mm/1/0/0">https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/tile/1.0.0/USGSHydroCached/default/default028mm/1/0/0</a><br>HTTP: Requesting [2/4] <a href="https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/tile/1.0.0/USGSHydroCached/default/default028mm/1/0/1">https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/tile/1.0.0/USGSHydroCached/default/default028mm/1/0/1</a><br>HTTP: Requesting [3/4] <a href="https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/tile/1.0.0/USGSHydroCached/default/default028mm/1/0/2">https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/tile/1.0.0/USGSHydroCached/default/default028mm/1/0/2</a><br>HTTP: Requesting [4/4] <b><a href="https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/tile/1.0.0/USGSHydroCached/default/default028mm/1/0/3">https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer/WMTS/tile/1.0.0/USGSHydroCached/default/default028mm/1/0/3</a></b></i></div><div><br></div><div>where the last tile does not exist. So it probably should stop at /1/0/2.</div><div>Isn't it a rounding error?</div><div><br></div><div>Best regards</div><div>Michał Kowalczuk</div><div><br></div><div><br></div></div></div>