Hi Even,

I agree that the first error message says it all and I guessed that the issue 
was in initializing the output to suit with the tile boundaries. I would also 
say that the documentation of MBTiles format is not so clear for users who have 
as little experience as I have, or less.

"The driver implements the Create() and IWriteBlock() methods, so that 
arbitrary writing of raster blocks is possible, enabling the direct use of 
MBTiles as the output dataset of utilities such as gdalwarp.

On creation, raster blocks can be written only if the geotransformation matrix 
has been set with SetGeoTransform() This is effectively needed to determine the 
zoom level of the full resolution dataset based on the pixel resolution, 
dataset and tile dimensions."

In this case also message ERROR 6: IWriteBlock() not supported if 
georeferencing not set
can make user to believe that there is something wrong with srs of input 
vectors.
-Jukka-

Lähettäjä: Even Rouault [mailto:even.roua...@spatialys.com]
Lähetetty: 18. joulukuuta 2017 13:12
Vastaanottaja: gdal-dev@lists.osgeo.org
Kopio: Rahkonen Jukka (MML) <jukka.rahko...@maanmittauslaitos.fi>
Aihe: Re: [gdal-dev] Why gdal_rasterize fails with MBTiles output?


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
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to