<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>Varying tile sizes: we definitely don't support that, and I don't
      think any of the OGC tiling specifications do. I guess that could
      be implemented (what can't?) but the WMS driver definitely doesn't
      currently. The code you spotted is for tiles at the right and
      bottom edges of the virtual raster, but there's no resampling
      involved. Support for varying tile sizes would imply that the
      driver resamples from the tile size of the tile to the GDAL
      advertized tile size.<br>
    </p>
    <p>One thing that the OGCAPI driver supports is tilematrixset with
      varying *number* of tiles by latitude ranges using the
      "variableMatrixWidths" feature. Cf
      <a class="moz-txt-link-freetext" href="https://docs.ogc.org/is/17-083r4/17-083r4.html#toc72">https://docs.ogc.org/is/17-083r4/17-083r4.html#toc72</a> . This also
      involves doing resampling in the driver.<br>
    </p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 08/03/2024 à 04:11, Charlie Savage
      via gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:0b4f10bb6390ef326ffe094a663e8f10dc9d6617@savagexi.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div>We have a custom tiling scheme (tilematrixset) for satellite
        imagery that varies tile widths as they move closer/farther from
        the equator. We do this for speed/efficiency reasons and the
        amount of error introduced is minimal over short distances and
        doesn't impat running CV algorithms. However, this means that
        our tiles may differ in width by a pixel for a paritcular
        satellite image (we tile the images).  <br>
      </div>
      <div><br>
      </div>
      <div>Using gdalbuildvirt to combine the tiles back into a single
        image  works fine.<br>
      </div>
      <div><br>
      </div>
      <div>However, we would like to serve them using the OGC tile api.
        And that doesn't work, due to this error:<br>
      </div>
      <div><br>
      </div>
      <blockquote>
        <div><span
style="color: rgb(29, 28, 29); font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgba(29, 28, 29, 0.04); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">ERROR 1: GDALWMS: Incorrect size 983 x 1232 of downloaded block, expected 982 x 1232, max 982 x 1232.
ERROR 1: GDALWMS: ReadBlockFromFile (0.0.0.0:5500/ogcapi/collections/1050010019917900---s---WV02---wv02---NA---NA/map/tiles/C1232_180_180/0/0/1.tif) failed.
ERROR 1: GDAL_WMS>, band 1: IReadBlock failed at X offset 0, Y offset 0: GDALWMS: ReadBlockFromFile (0.0.0.0:5500/ogcapi/collections/1050010019917900---s---WV02---wv02---NA---NA/map/tiles/C1232_180_180/0/0/1.tif) failed.</span><br>
        </div>
        <div><br>
        </div>
      </blockquote>
      <div><br>
      </div>
      <div>The code that causes this is:<br>
      </div>
      <div><span
style="color: rgb(29, 28, 29); font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgba(29, 28, 29, 0.04); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span><br>
      </div>
      <div><br>
      </div>
      <blockquote><span
style="color: rgb(29, 28, 29); font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgba(29, 28, 29, 0.04); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span>
        <div style="background-color:#ffffff;color:#080808">
          <pre
style="font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span
          style="color: rgb(140, 140, 140);"></span>
</pre>
          <pre
style="font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span
          style="color: rgb(140, 140, 140);"><i>/* expected size */
</i></span><span style="color:#0033b3;">const int </span><span
          style="color:#000000;">esx </span>= <span
          style="color: rgb(31, 84, 46);"><b>MIN</b></span>(MAX(<span
          style="color:#1750eb;">0</span>, (<span style="color:#000000;">x </span>+ <span
          style="color:#1750eb;">1</span>) * <span
          style="color:#660e7a;">nBlockXSize</span>), <span
          style="color:#660e7a;">nRasterXSize</span>) -<div>
</div>                <span style="color: rgb(31, 84, 46);"><b>MIN</b></span>(MAX(<span
          style="color:#1750eb;">0</span>, <span style="color:#000000;">x </span>* <span
          style="color:#660e7a;">nBlockXSize</span>), <span
          style="color:#660e7a;">nRasterXSize</span>);<div>
</div><span style="color:#0033b3;">const int </span><span
          style="color:#000000;">esy </span>= <span
          style="color: rgb(31, 84, 46);"><b>MIN</b></span>(MAX(<span
          style="color:#1750eb;">0</span>, (<span style="color:#000000;">y </span>+ <span
          style="color:#1750eb;">1</span>) * <span
          style="color:#660e7a;">nBlockYSize</span>), <span
          style="color:#660e7a;">nRasterYSize</span>) -<div>
</div>                <span style="color: rgb(31, 84, 46);"><b>MIN</b></span>(MAX(<span
          style="color:#1750eb;">0</span>, <span style="color:#000000;">y </span>* <span
          style="color:#660e7a;">nBlockYSize</span>), <span
          style="color:#660e7a;">nRasterYSize</span>);<div>
</div><div>
</div><span style="color:#0033b3;">int </span><span
          style="color:#000000;">sx </span>= <span
          style="color:#000000;">ds</span>->GetRasterXSize();<div>
</div><span style="color:#0033b3;">int </span><span
          style="color:#000000;">sy </span>= <span
          style="color:#000000;">ds</span>->GetRasterYSize();

</pre>
          <pre
style="font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span
          style="color: rgb(140, 140, 140);"><i>/* Allow bigger than expected so pre-tiled constant size images work on
</i></span><span style="color: rgb(140, 140, 140);"><i> * corners */</i></span></pre>
        </div>
        <span
style="color: rgb(29, 28, 29); font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; font-style: normal; font-variant-ligatures: none; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgba(29, 28, 29, 0.04); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">if ((sx > nBlockXSize) || (sy > nBlockYSize) || (sx < esx) || (sy < esy))
{
    CPLError(CE_Failure, CPLE_AppDefined,
             "GDALWMS: Incorrect size %d x %d of downloaded block, "
             "expected %d x %d, max %d x %d.",
             sx, sy, esx, esy, nBlockXSize, nBlockYSize);
    ret = CE_Failure;
}</span></blockquote>
      <div><br>
        I was hoping that the comment about bigger than expected size
        images would work, but from the error message above it does not.</div>
      <div><br>
      </div>
      <div>So I expect the answer is no, but is there any way we could
        work around, loosen or disable this restriction? Or some other
        idea on how to make this work?<br>
      </div>
      <div><br>
        Thanks,</div>
      <div><br>
      </div>
      <div>Charlie<br>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>