You can combine OpenMapTiles with your custom vector data saved in ShapeFile or GeoJSON (there is separate article for data stored in PostGIS database). Easy way is to convert your data into vector tiles and then combine it with standard OpenMapTiles source in a map style. Big advantage of this approach is that you don’t need to generate the whole OpenMapTiles schema that is quite time-consuming.

Create vector tiles from GeoJSON or ShapeFile

If you are on Linux or OS, you can use a command-line tool tippecanoe from Mapbox. See installation instructions.

Before using tippecanoe, you need to transform your data into EPSG:4326. You can use for example ogr2ogr utility that is part of gdal:

ogr2ogr -f GeoJSON your_data_in_4326.json -t_srs EPSG:4326 your_data.shp

Having your data in right EPSG, you can do the conversion using tippecanoe. The most simple use case is:

tippecanoe -o your_data.mbtiles your_data_in_4326.json

It will convert your data into MBTiles for zoom levels 0 to 14. Tippecanoe enables much more sophisticated options including layer and attribute management, dropping features, generalization, and more. See documentation.

You can visually check the generated MBTiles file using TileServer-GL:

docker run -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl your_data.mbtiles

Data preview with TileServer-GL: Data preview with TileServer-GL

Combine your vector tiles with OpenMapTiles

After creating vector tiles, you can combine it with standard OpenMapTiles layer in one map style. It can be done in the same way as in case of raster tiles.

K is an open-source project from Klokan Technologies GmbH and OSM community
Share this page on