Mapnik vector tile API
npm install mapnik-vector-tile
|19||downloads in the last day|
|747||downloads in the last week|
|1 821||downloads in the last month|
|Version||0.4.2 last updated 12 days ago|
A high performance library for working with vector tiles.
Provides C++ headers that support rendering geodata into vector tiles and rendering vector tiles into images.
- Mapnik > = v2.2.x:
Vector tiles in this code represent a direct serialization of Mapnik layers optimized for space efficient storage and fast deserialization. For those familiar with the Mapnik API vector tiles here can be considered a named array of
mapnik::featureset_ptr whose geometries have been pre-tiled.
A vector tile can consist of one or more ordered layers identified by name and containing one or more features.
Features contain attributes and geometries: either point, linestring, or polygon.
Geometries are stored as an x,y,command stream (where
command is a rendering command like move_to or line_to). Geometries are clipped, reprojected into spherical mercator, converted to screen coordinates, and delta and zigzag encoded.
Feature attributes are encoded as key:value pairs which are dictionary encoded at the layer level for compact storage of any repeated keys or values. Values use variant type encoding supporting both unicode strings, boolean values, and various integer and floating point types.
Vector tiles are serialized as protobuf messages which are then zlib compressed.
The assumed projection is Spherical Mercator (
Ubuntu Dependencies Installation
apt-get install libprotobuf7 libprotobuf-dev protobuf-compiler apt-add-repository ppa:mapnik/v2.2.0 apt-get update && apt-get install libmapnik libmapnik-dev
OS X Dependencies Installation
brew install protobuf brew install mapnik
This builds the protobuf C++ wrappers:
vector_tile.pb.cc in your code. The rest is header only.
Run the C++ tests like:
See examples in examples/c++
These require the protobuf python bindings and the
which can be installed like:
sudo apt-get install libspatialindex-dev pip install protobuf rtree
To build and test the python example code do:
make python && make python-test
Run the example code: