Skip to content

Implementations

Tom MacWright edited this page Jun 2, 2014 · 37 revisions

This page lists implementations of software that work with vector tiles using the Mapbox protobuf format.

Overall node-mapnik (which uses mapnik-vector-tile internally) was the first implementation of the core concepts for working with vector tiles. It provides a mapnik.VectorTile object that can be used in a read/write fashion and is able to serialize data into protobuf format as well as GeoJSON. It is the basis for, and a dependency of, most of the other serverside software below that provide APIs to vector tiles. Learn more about what node-mapnik implements by checking out the vector tile tests and API documentation.

Serialization format

Vector tiles can be serialized/encoded in a variety of formats

  • Protocol Buffers (aka protobuf or pbf). This is the most optimal format for encoding both for size and parsing speed.
  • GeoJSON - This format is slightly less optimal for space and slower to parse (in most circumstances) but works great for many purposes. node-mapnik is able to convert vector tiles from protobuf format to GeoJSON.

Protobuf schema for serialization

The encoding specification for the format currently can be found inside mapnik-vector-tile.

Servers

  • TileMill 2.x - TileMill is a desktop design studio for both creating and rendering vector tiles, but internally uses tilelive.js modules to handle vector tiles (see tilelive-bridge and tilelive-vector below).
  • tessera - A developers toolbox for working with tiles in a variety of formats but specialized to make setting up tile urls easy for working with vector tiles. Uses the same core libraries as TileMill.

Parsers (decoding)

  • pbf.hpp - A C++ header-only protobuf decoder designed be used as a basis to to build a lazy vector tile decoder.
  • pbf.js - A Javascript protobuf decoder designed be used as a basis to to build a lazy vector tile decoder either in the browser or serverside with node.js
  • Java: java-vector-tile

Serialization (encoding)

  • C++ vector tile pbf API / vector_tile.pb.cc - This C++ API is used by node-mapnik under the hood for serialization. The files are autogenerated by the Protocol Buffer compiler by running the command protoc -Iproto/ --cpp_out=./src proto/vector_tile.proto. The reason this code is autogenerated is to be able to target different libprotobuf versions you might have installed. Example usage of this api can be seen in the tileinfo tool.
  • Java: java-vector-tile

Storage

  • node-mbtiles can be used to store vector tiles inside the mbtiles format (basically inside a single sqlite database). While node-mbtiles does not known anything specific about vector tiles, it works fine for this task because its generic enough and supports inserting any binary blog for a tile (either an image like a png or a protobuf like vector tiles).

Write

  • tilelive-bridge is an API for creating vector tiles from traditional geodata sources like shapefiles and GeoJSON. It is used inside TileMill 2.x and depends on node-mapnik.
  • Datamaps can be used to create vector tiles and store them in an mbtiles. See the render-vector command.
  • vector-tiles-producer Command line tool in C++ to creates vector tiles for a given area at chosen zoom levels using a Mapnik XML.

Read

  • tilelive-vector (uses node-mapnik) is able to render vector tiles to style image tiles given a Mapnik/TileMill stylesheet
  • WhirlyGlobe/Maply is able to read and render vector tiles(and style with mapnik xml) on iOS devices.

Debugging tools

  • tileinfo Command line tool to inspect what is inspect a vector tile.

Sample Code

Code that might not be fully fledged sofware, but demonstrates concepts or interesting uses of vector tiles

  • vector-tile-query-bench - Simple script which times how long various operations take for working with a single reasonably large z14 tile in San Francisco. The script times how long it takes to zlib.inflate (uncompress), parse the data into the internal protobuf objects needed to interrogate the data, how long it takes to transform it into JSON and GeoJSON, and how long it takes to query the raw feature geometries compared to rendering a utfgrid. Both the the latter methods are two ways to learn what features exist at a given point in the tile.
Clone this wiki locally