<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.Shkpostityyli18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-ligatures:none;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">Lähettäjä:</span></b><span lang="EN-US"> gdal-dev <gdal-dev-bounces@lists.osgeo.org>
<b>Puolesta </b>Michal Kowalczuk via gdal-dev<br>
<b>Lähetetty:</b> torstai 29. elokuuta 2024 12.01<br>
<b>Vastaanottaja:</b> gdal-dev@lists.osgeo.org<br>
<b>Aihe:</b> [gdal-dev] WMTS gdal_translate vs RasterIO<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal">Hi once again!<o:p></o:p></p>
<div>
<p class="MsoNormal">I came across another problem using WMTS.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The following translate command:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>gdal_translate -srcwin 0 0 1073741760 1553779 -outsize 691 1 "WMTS:<a href="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</a>"
tile.png</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">passes with no errors. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">If I use similar invoke of GDALRasterIO from C API I get the following error:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>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.</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>GDALDatasetRasterIO(</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>handle_to_wmts_subdataset,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>eRWFlag=GF_Read,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nXOff=0,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nYOff=0,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nXSize=1073741760,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nYSize=1553779,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>pBuffer - buffer for data,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nBufXSize=1,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nBufYSize=691,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>eBufType=GDT_Byte,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nBandCount=4,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>panBandMap=[bIndex ,gIndex, rIndex, aIndex],</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nPixelSpace=4,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nLineSpace=0,</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>nBandSpace=1)</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Can anyone explain me hot to interpret the mentioned error:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b>Requested (0,0) of size 1073741760x1553779 on raster of 1073741756x1347126255?</b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Micha³<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>