[GRASS-dev] MBTiles format export tool (halfway)

Hamish hamish.webmail at gmail.com
Mon May 19 02:38:42 PDT 2014


Hamish wrote:
> If it is useful to anyone I've just written an addon module which will
> let you export a grass raster map as a TMS tileset and uDig mapurl
> file ready to be copied into Geopaparazzi, which will then convert it
> to the MBTiles sqlite web tile database format. MBTiles is used for
> Tilemill and other web tile softwares to avoid 2^n number of tiny
> tiles clogging up your filesystem, handle deduplication, and other
> nice things. GDAL support (read-only) since 1.10.
> 
> Relying on Geopaparazzi on Android to do the final conversion then
> copying back the results is a bit awkward/slow, so I'd enjoy to see
> the addon module create the MBTiles sqlite db directly. It looks
> pretty straight forward, but sadly my SQL foo is lacking.
> 
> ( https://github.com/mapbox/mbtiles-spec/blob/master/1.2/spec.md )

[correction 1.2 is unreleased, use spec v1.1]

> once that is working the idea is to buy the co-author a beer and
> rename the module to r.out.mbtiles.

ok, I was able to add a flag to (experimentally) export MBTiles
databases directly as long as sqlite3 is installed. Both gdalinfo 1.10
and qgis2 seem to be happy with it. It could still use improvement by
replacing the image blobs with an index number view and having another
table for storing the unique images. That way all ocean/wasteland tiles
only need to be stored once in the database and the file can be quite a
bit smaller. For well-cropped aerial imagery and satellite data I guess
we wouldn't have much repeated data, but for categorical CELL maps it
could help things a lot.

If anyone wants to help with the fancy SQL views and ID lookup table I
can provide as an example a sqlite db of the North Carolina soilsID
raster converted by Geopaparazzi's TMS import background job. I'm
afraid that much really is beyond my SQL.


regards,

-- 
Hamish <hamish.webmail at gmail.com>


More information about the grass-dev mailing list