Implementation of MVT (Mapnik Vector Tiles) data format.
Mapnik's PythonDatasource.features() method can return a list of WKB features,
pairs of WKB format geometry and dictionaries of key-value pairs that are
rendered by Mapnik directly. PythonDatasource is new in Mapnik as of version
The MVT file format is a simple container for Mapnik-compatible vector tiles
that minimizes the amount of conversion performed by the renderer, in contrast
to other file formats such as GeoJSON.
An MVT file starts with 8 bytes.
4 bytes "\x89MVT"
uint32 Length of body
bytes zlib-compressed body
The following body is a zlib-compressed bytestream. When decompressed,
it starts with four bytes indicating the total feature count.
uint32 Feature count
bytes Stream of feature data
Each feature has two parts, a raw WKB (well-known binary) representation of
the geometry in spherical mercator and a JSON blob for feature properties.
uint32 Length of feature WKB
bytes Raw bytes of WKB
uint32 Length of properties JSON
bytes JSON dictionary of feature properties
By default, encode() approximates the floating point precision of WKB geometry
to 26 bits for a significant compression improvement and no visible impact on
rendering at zoom 18 and lower.