Skip to main content

A Rasterio plugin command that exports MBTiles

Project description

A plugin for the Rasterio CLI that exports a raster dataset to the MBTiles (version 1.1) format. Features include automatic reprojection and parallel processing.


$ rio mbtiles --help
Usage: rio mbtiles [OPTIONS] INPUT [OUTPUT]

  Export a dataset to MBTiles (version 1.1) in a SQLite file.

  The input dataset may have any coordinate reference system. It must have
  at least three bands, which will be become the red, blue, and green bands
  of the output image tiles.

  If no zoom levels are specified, the defaults are the zoom levels nearest
  to the one at which one tile may contain the entire source dataset.

  If a title or description for the output file are not provided, they will
  be taken from the input dataset's filename.

  This command is suited for small to medium (~1 GB) sized sources.

  Python package: rio-mbtiles (

  -o, --output PATH       Path to output file (optional alternative to a
                          positional arg).
  --force-overwrite       Always overwrite an existing output file.
  --title TEXT            MBTiles dataset title.
  --description TEXT      MBTiles dataset description.
  --overlay               Export as an overlay (the default).
  --baselayer             Export as a base layer.
  --format [JPEG|PNG]     Tile image format. PNG format required for nodata
                          values to display as transparent.
  --zoom-levels MIN..MAX  A min..max range of export zoom levels. The default
                          zoom level is the one at which the dataset is
                          contained within a single tile.
  --image-dump PATH       A directory into which image tiles will be
                          optionally dumped.
  -j INTEGER              Number of worker processes (default: 3).
  --src-nodata FLOAT      Manually override source nodata
  --dst-nodata FLOAT      Manually override destination nodata
  --resampling            Resampling method to use. Options within
                          rasterio.enums.Resampling are supported.
                          (default: nearest)
  --version               Show the version and exit.
  --help                  Show this message and exit.


The rio-mbtiles command is suited for small to medium (~1 GB) raster sources. On a MacBook Air, the 1:10M scale Natural Earth raster (a 21,600 x 10,800 pixel, 700 MB TIFF) exports to MBTiles (levels 1 through 5) in 45 seconds.

$ time GDAL_CACHEMAX=256 rio mbtiles NE1_HR_LC.tif \
> -o ne.mbtiles --zoom-levels 1..5 -j 4

real    0m44.925s
user    1m20.152s
sys     0m22.428s


If you’ve already installed Rasterio, installation is just pip install rio-mbtiles.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rio-mbtiles, version 1.4.0
Filename, size File type Python version Upload date Hashes
Filename, size rio_mbtiles-1.4.0-py2-none-any.whl (7.0 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size rio_mbtiles-1.4.0-py3-none-any.whl (7.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size rio-mbtiles-1.4.0.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page