[gdal-dev] Variable Tile Sizes

Even Rouault even.rouault at spatialys.com
Fri Mar 8 04:01:16 PST 2024


Hi,

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.

One thing that the OGCAPI driver supports is tilematrixset with varying 
*number* of tiles by latitude ranges using the "variableMatrixWidths" 
feature. Cf https://docs.ogc.org/is/17-083r4/17-083r4.html#toc72 . This 
also involves doing resampling in the driver.

Even

Le 08/03/2024 à 04:11, Charlie Savage via gdal-dev a écrit :
> 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).
>
> Using gdalbuildvirt to combine the tiles back into a single image  
> works fine.
>
> However, we would like to serve them using the OGC tile api. And that 
> doesn't work, due to this error:
>
>     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.
>
>
> The code that causes this is:
>
>
>
>     //* expected size */ /const int esx =*MIN*(MAX(0, (x +1) *nBlockXSize),nRasterXSize) -
>                      *MIN*(MAX(0,x *nBlockXSize),nRasterXSize);
>     const int esy =*MIN*(MAX(0, (y +1) *nBlockYSize),nRasterYSize) -
>                      *MIN*(MAX(0,y *nBlockYSize),nRasterYSize);
>     int sx =ds->GetRasterXSize();
>     int sy =ds->GetRasterYSize();
>
>     //* Allow bigger than expected so pre-tiled constant size images
>     work on //* corners *//
>
>     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; }
>
>
> I was hoping that the comment about bigger than expected size images 
> would work, but from the error message above it does not.
>
> 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?
>
> Thanks,
>
> Charlie
>
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240308/eb3ad01a/attachment.htm>


More information about the gdal-dev mailing list