Skip to content

icetan/gdal2mbt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gdal2mbt

Create MBTiles from a GDAL file

Requirements

  • Python 2.7
  • GDAL >=1.8

Installation

Stable release from PyPI.

pip install gdal2mbt

Or latest straight from the source.

pip install https://github.com/icetan/gdal2mbt/archive/master.zip

Development

To browse source and make modifications.

git clone https://github.com/icetan/gdal2mbt.git
pip install -e ./gdal2mbt

Creating a MBTile file

Create a MBTile from a GDAL VRT. (Creating a VRT)

gdal2mbt create goteborg.mbtiles 8 goteborg.vrt

Or use a JSON config file with an optional metadata dictionary that will overwrite the defaults in the MBTiles metadata table.

{
    "source": "goteborg.vrt",
    "num_levels": 8,
    "metadata": {
        "name": "goteborg",
        "description": "Aerial photos over Göteborg city"
    }
}
gdal2mbt create -c goteborg.json goteborg.mbtiles

To resume an aborted MBTiles creation process pass the -r flag to create.

Parallel jobs

Speed up MBTiles creation by distributing the load over several processors or even computers by using GNU Parallel.

Create an MBTiles file for each tile on zoom level 0, this will depend on the second argument which defines how many zoom levels to generate in total.

gdal2mbt config goteborg.vrt 6 | parallel gdal2mbt create -c

Merge all the created MBTiles to one.

gdal2mbt merge goteborg.mbtiles goteborg.*.mbtiles

Or to squash all MBTiles into one to save space use the destructive -s flag which will remove each merged MBTiles file.

gdal2mbt merge -s goteborg.*.mbtiles

Add zoom levels that might have been omitted due to the amount of tiles on zoom level 0 at time of creation.

gdal2mbt levels goteborg.mbtiles 8

About

Create MBTiles from a GDAL file

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages