TileStache.Goodies.VecTiles.mvt | index

`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
2.1.0.
More information:
http://mapnik.org/docs/v2.1.0/api/python/mapnik.PythonDatasource-class.html
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.`

Modules

``

json |  |  |

Functions

``

decode(file)
  `Decode an MVT file into a list of (WKB, property dict) features.
  Result can be passed directly to mapnik.PythonDatasource.wkb_features().`

encode(file, features)
  `Encode a list of (WKB, property dict) features into an MVT stream.
  Geometries in the features list are assumed to be in spherical mercator.
  Floating point precision in the output is approximated to 26 bits.`