Dotan
Dotan

Reputation: 7622

OSM data to mapBox format

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

Those include:

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.

Upvotes: 5

Views: 10591

Answers (3)

After some long time search, here is my conclusion at the very moment:

  • gdal should be useful with ogr2ogr cli tool converter. Theorically, it is able to convert from osm to mvt (geojson step should not be mandatory).

  • tippecanoe does a quiet equivalent thing, from geojson to mvt (ogr2ogr or osmium can help to convert from .osm to .geojson)

But the devil is in details: you need to be explicit on what data go on what mvt layer (water, roads, buildings, etc...). I've not found a convenient "all-in-one" tool able to convert osm building or building parts polygons and relations into mvt buildings layer, and so on... It looks like each team (mapbox and co) keeps it secretely behind API services with API key system.

Upvotes: 0

JaakL
JaakL

Reputation: 4295

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.

Upvotes: 0

scai
scai

Reputation: 21499

The mapbox/awesome-vector-tiles repository at GitHub has a long list of Mapbox Vector Tile implementations. This is the list as of today:

Parsers & Generators

  • vector-tile-js - Parses vector tiles with JavaScript.
  • mapnik-vector-tile - C++ vector tile read/write implementation on top of Mapnik.
  • mbtiles-cpp - C++ library for decoding of mbtiles and vector data into function callbacks.
  • vector-tile-py - Python tool to convert a Mapnik vector tile to GeoJSON
  • node-mapnik - Node.js API for vector tiles which depends on mapnik-vector-tile
  • vector-tile-cs - Parses vector tiles with C# (native C# implementation, no dependencies).
  • mapbox-vector-tile-cs - Parses vector tiles with C# (uses protobuf-net).
  • tilelive-bridge - Implements Tilelive API for creating vector tiles from traditional Mapnik datasources in Node.js.
  • tilelive-vector - Implements Tilelive API for reading vector tiles and rendering to image tiles in Node.js.
  • mapbox-vector-tile is a Python package for vector tile encoding maintained by Mapzen. (It is used in Mapzen's vector tile service).
  • geojson-vt - Slice GeoJSON into vector tiles on the fly in the browser.
  • java-vector-tile - A java encoder and decoder for vector tiles.
  • mapbox-vector-tile-java - Encode and decode v2.1 Mapbox Vector Tiles. Convert JTS Geometry to and from MVT features, including simple user data support. Utility functions for converting world coordinates to MVT coordinates and clipping to a tile envelope.
  • cached-vector-tile - An alternative implementation of the vector-tile-js interface, backed by plain JS objects/arrays rather than parsed-on-demand protobuf data. Trades away memory efficiency for faster feature.loadGeometry() calls.
  • tilegrinder - A helper library for applying a data altering function on each vector tile in an MBTiles, using the native protobuf wrapper for de- and encoding, recompressing the results and storing them either in an MBTiles or as single files.
  • SwiftVectorTiles - A Swift encoder for vector tiles according to the Mapbox vector tile spec.

Clients

  • Mapbox GL Native - C++/OpenGL vector maps library with native SDKs for Android, iOS, Node.js, macOS, and Qt
  • Mapbox GL JS - JavaScript/WebGL vector maps library.
  • OpenLayers 3 - JavaScript vector & raster library.
  • WhirlyGlobe/Maply - Objective C code that is able to read and render vector tiles(and style with mapnik xml) on iOS devices.
  • Leaflet.MapboxVectorTile is able to read PBF MapboxVectorTiles from a REST endpoint and render them as a TileLayer on a Leaflet Map. Use this option if you want to utilize vector tiles on a standard Leaflet web map without needing WebGL.
  • CARTO Mobile SDK - C++ maps library focused on offline features, for iOS, Android, Windows Phone and Xamarin with bindings for Java, Objective-C and C#. Based on Nutiteq Maps SDK, but open source and uses CartoCSS.
  • Mapzen Tangram - JavaScript library for rendering 2D & 3D maps live in a web browser with WebGL, supports MVT, GeoJSON, TopoJSON
  • Mapzen Tangram-es - C++ library for rendering 2D and 3D maps using OpenGL ES 2 with custom styling and interactions
  • mapbox-gl-leaflet - Create Mapbox GL layers in Leaflet
  • react-native-mapbox-gl - Render Mapbox GL maps from React applications
  • hoverboard - Render vector tiles on canvas with Leaflet 0.7.x (supports GeoJSON, TopoJSON, and protobuf)
  • Leaflet.VectorGrid - Display gridded vector data (sliced GeoJSON, TopoJSON or Mapbox Vector Tiles) in Leaflet 1.0.0
  • ArcGIS API for JavaScript - Draw vector tile layers as part of your web map. Rendering done via mapbox-gl-js integration.
  • mapscii - A Vector Tile to Braille and ASCII renderer for xterm-compatible terminals

Applications / Command line tools

  • Mapbox Studio - Desktop design studio for both creating vector tiles from raw geodata and for rendering them on-the-fly into image tiles. Internally uses tilelive.js modules to handle vector tiles (see tilelive-bridge and tilelive-vector)
  • kosmtik - Design maps with CartoCSS and Mapnik.
  • ArcGIS Pro - Generate vector tiles from maps authored in ArcGIS Pro or imported from ArcMap.
  • MVT Styler - map style editor for vector tiles.
  • Maputnik - A visual style editor for the Mapbox GL style specification.

CLI Utilities

  • Datamaps C application that can be used to create vector tiles and store them in an mbtiles. See the render-vector command.
  • tilemaker - Command line tool to produce vector tiles directly from an .osm.pbf extract without an intermediate database.
  • vector-tiles-producer Command line tool in C++ to creates vector tiles for a given area at chosen zoom levels using a Mapnik XML.
  • tippecanoe - Build vector tilesets from large collections of GeoJSON features.
  • vt-geojson - decodes vector tiles to GeoJSON FeatureCollections
  • tl - An alternate command line interface to tilelive
  • tileshrink - Reduce the layer extent and simplify the resulting geometries of all vector tiles in an MBTiles
  • tiler - Command line tool for converting GeoJSON, Shapefiles or PostGIS layer to raw Vector Tiles (or MBTiles)
  • geojson2mvt - npm package for building a static vector tile tree for given xyz bounds from a geojson file (uses vt-geojson)

Mapbox GL JS Plugins

  • gl-draw - Adds support for drawing and editing features on Mapbox GL JS maps

Servers

  • tessera - Supports serving and rendering vector tiles. Uses the same core libraries as Mapbox Studio.
  • tilestrata - with tilestrata-vt, it can generate Mapnik Vector Tiles; with tilestrata-postgismvt, it can serve Mapbox Vector Tiles from a PostGIS db
  • SpatialServer (PGRestAPI) - A multi-purpose GeoSpatial NodeJS web server created at SpatialDev that not only serves MBTiles stuffed with vector tiles, it can also cut vector tiles on the fly from a PostGIS database.
  • Utilery Server to generate vector tiles from PostGIS queries. Python based
  • tileserver Mapzen Vector Tile Service.
  • TileStache added support for Mapbox Vector tiles via .pbf extension requests.
  • Kartotherian Wikipedia tile server with Tilerator backend tile pre-generator
  • ArcGIS Online - Supports serving vector tiles and rendering in the mapping application powered by the ArcGIS API for JavaScript
  • Portal for ArcGIS - Supports serving vector tiles and rendering in the mapping application powered by the ArcGIS API for JavaScript
  • tilesplash - A light and quick nodejs webserver for serving topojson or mapbox vector tiles from a postgis backend
  • go-vtile-example - An example server written in Go
  • Tegola - A MVT server written in pure Go that supports serving tiles from a PostGIS data provider.
  • t-rex - MVT server in a single executable written in Rust. Serves tiles from PostGIS supporting custom tile grids.

Low-level utilities

  • mapbox-gl-function - Mapbox GL style function evaluator
  • mapbox-gl-filter-simplify - Simplifies and complexifies filters in Mapbox GL Styles
  • vt-pbf serialize JavaScript objects representing vector tiles into binary Protocol Buffer encodings of vector tiles

Articles

Upvotes: 6

Related Questions