generate-mbtiles Command

Contents

Generates map tiles which can be used by a web map server. The tiles are generated in the MBTiles format which was created and popularized by MapBox.

The main benefit of MBTiles format is that all of the tiles are stored in a single SQLite file which makes it much easier to upload the tiles to a web server.

Usage

generate-mbtiles [parameters]

All parameters are optional:

Performance And Storage Considerations

Be careful when specifying zoom levels. Each zoom level needs about four times as many tiles as the previous one, so you can very quickly reach pretty large numbers of tiles which can take a very long time to generate and require a lot of disk space.

Let's say we have a map that on zoom level 10 roughly covers the whole computer screen (this would approximately be the area of London and its immediate surroundings). That means about 15 tiles for the zoom level 10. What happens if we want to generate tiles for the whole map up to the zoom level 19?

NOTE: These numbers are a very rough estimate. When calculating the time needed, an average speed of 50 tiles per second was used, which may vary substantially depending on the map complexity and on the computer hardware performance.

Web Maps

generate-mbtiles Command uses all the map sources currently registered in the map. This includes web maps (like OSM base map or Osmarender), so if you have one of those, be warned that tiles generation will take a very long time since the generator has to download each tile from the web before it can generate a tile itself. In order not to overload OSM servers, Maperitive limits how fast web tiles can be downloaded.

Tiles Transparency

There are various ways of achieving transparency of map tiles. The most common way is to make the background transparent, while all the other rendered content opaque. This is achieved by setting the MapBackgroundOpacity (TODO) in your rules to a value other than 1 (which represents a fully opaque color), usually by setting the background to be fully transparent:

properties
	...
	map-background-opacity : 0
	...

NOTE: This works only if all of the map sources on the map support transparency. Once you have web maps, for example, map-background-opacity will not be able to keep the background transparent.

The map on the screen will be drawn using a black background (since it is completely transparent) - this is normal behavior.

Examples

generate-mbtiles

Generates tiles using the default behavior.

generate-mbtiles minzoom=5 maxzoom=8

Generates tiles from the zoom level 5 up to the zoom level 8.

See also: