[gdal-dev] Why gdal_rasterize fails with MBTiles output?

Even Rouault even.rouault at spatialys.com
Mon Dec 18 03:12:25 PST 2017


Jukka,

> 
> gdal_rasterize -ot Byte  -burn 255 -burn 0 -burn 0 -ts 4950 4950
> -of MBTiles points_3857.json points_3857.mbtiles
> ERROR 6: Could not find an appropriate zoom level that matches raster pixel
> size

The error message says it all, doesn't it ? MBTiles only accepts a single tiling scheme, with a 
pre-defined set of zoom levels / resolutions. By default, when gdal_rasterize will initialize the 
output raster, the chance that it fits to those constraints is extremely unlikely.

Now you may wonder why you can gdal_translate an arbitrary raster as MBTiles. This is 
because MBTiles (similarly to GeoPackage with a predefined tiling scheme) sheat in its 
CreateCopy() implementation to invoke the warping engine to reproject/resample to one of 
the compatible zoom level.

But gdal_rasterize use the Create() interface, so this isn't possible.

Obvious workaround: rasterize to TIF and translate to MBTiles.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171218/b410ff99/attachment.html>


More information about the gdal-dev mailing list