Search code examples
openstreetmapmapbox

OSM data to mapBox format


I saw several places where OSM data is converted to MVT (mapbox vector tiles) for simple rendering.

Those include:

  • OSRM which provides MVT based image of the route for rendering
  • OpenMapTiles which enables downloading of OSM maps in MVT format
  • GeoServer which can import OSM and export MVT

Is there a simple tool to convert OSM data to MVT locally?

I have my own data in OSM format that I want to convert to MVT and store locally, without rendering to a map image.


Solution

  • Specific thing with MVT is that this is tiled and multi-resolution (zoom-based) display-optimized, more like "rendered" map for visual fast rendering and styling, it is not your typical geodata format really. For example it does not have geographical coordinates in it, it has "pixel space" coordinates in tiles for your vector objects. This makes 'simple conversion' from/to geodata quite tricky, and very typical conversion solution is a strange one - use use map server or service with your data and then scrape tiles from it. For tile scraping the best tool seems to be tilelive-copy.

    However, closest what you may want from the long list above would be tippecanoe which converts GeoJSON to MVT (in a mbtiles file). If your data is in .osm format, then you need to convert it to geojson; but there are other tools for it, for example ogr2ogr. Be aware that OSM files include many data layers and the structure is quite specific, so you need to find well-working configurations for all conversion steps.