GRASS logo

NAME

r.out.mbtiles

DESCRIPTION

r.out.mbtiles creates a TMS tileset and support files ready to load into software like Geopaparazzi or Tilemill. It will optionally generate a MBTiles SQLite database from the tile tree.

NOTES

Either an individual raster map or a raster map imagery group may be given as input.

If not specified the zoom level will be automatically chosen.

The MBTiles output file has not been deduplicated to only store unique images in the database. Currently this can be accomplished by copying the tile tree onto an Android device and letting Geopaparazzi create the .mbtiles file. To do this, copy the output directory and mapurl file to /sdcard/maps/ on your Android device and select the mapurl file as the tile source in Geopaparazzi. The MBTiles SQLite database will then be populated in the background.

If the MBUtil program is installed you can use it as an alternate method to convert the tile tree into a highly optimized MBTiles database.

Too many tiles? Use the zoom parameter to limit the current operation to a single zoom level, then crop the region with g.region to where you need detailed coverage and re-run the tile creation with a higher zoom level. Afterwards you can combine the directories into a single tree and adjust the maxzoom and minzoom values in the mapurl file as needed.

Android users, note that the maximum filesize on SD cards is often 2 GB, depending on the filesystem used.

EXAMPLE

Example 1: Creates a tileset for the North Carolina sample dataset's soilsID raster map at automatically chosen zoom levels 11-14.
g.region rast=soilsID
r.out.mbtiles in=soilsID out=soil_tiles format=jpeg

Example 2: Drape the soils map over a shaded relief of the elevation map, and bundle it up into a tarball for easier copying.

g.region rast=soilsID
d.mon x0
d.resize w=750 h=675
r.colors -e elevation_shade color=sepia
d.shadedmap relief=elevation_shade drape=soilsID output=shaded_soilsID

r.out.mbtiles -t in=shaded_soilsID out=shaded_soil_tiles format=jpeg

Example 3: Take a series of georegistered JPEG images (with .jgw world files), combine them into a virtual raster map with GDAL's gdalbuildvrt, import into a virtual GRASS raster map with r.external, and export as a TMS tileset ready for conversion into MBTiles. This is somewhat more computationally expensive but much easier on the disk space since the intermediate files are relatively tiny.

gdalbuildvrt ortho_images.vrt *.jpg
r.external in=ortho_images.vrt out=ortho.mosaic \
   title="Rural Aerial Photos (2009-2011)"
g.region rast=ortho.mosaic.1

r.out.mbtiles -m in=ortho.mosaic out=ortho_mosaic format=jpeg

TODO

Ability to create the MBTiles SQLite database with a deduplication process to store only unique tile images.

On MS Windows gdal2tiles.py is called gdal2tiles.bat. Some minor adjust is needed in the script to select the correct name.

SEE ALSO

i.group

gdal2tiles
mapurl specification

AUTHOR

Hamish Bowman
Department of Geology
University of Otago
Dunedin, New Zealand

Last changed: $Date$


Main index - raster index - Full index

© 2003-2016 GRASS Development Team