Skip to content

Experimental Cython wrapper around vtzero

Notifications You must be signed in to change notification settings

schneidemar/python-vtzero

 
 

Repository files navigation

python-vtzero

Experimental Python wrapper of vtzero a minimalist vector tile decoder and encoder in C++

Status Packaging status

Requirements

  • Python >= 3.5
  • gcc/clang++ >= 4.5 (C++11)

Install

You can install python-vtzero using pip

$ pip install vtzero

or install from source

$ git clone https://github.com/tilery/python-vtzero
$ cd python-vtzero

# Download vendor submodules (protozero, mvt-fixtures, vtzero)
$ git submodule update --init

# Compile Cython module
$ python setup.py build_ext --inplace
$ pip install -e .

Example

A complete example can be found here

from vtzero.tile import VectorTile, Tile, Layer, Point

# Create MVT
tile = Tile()

# Add a layer
layer = Layer(tile, b'my_layer')

# Add a point
feature = Point(layer)
feature.add_points(1)
feature.set_point(10, 10)
feature.add_property(b'foo', b'bar')
feature.add_property(b'x', b'y')
feature.commit()

# Encode mvt
data = tile.serialize()

About

Experimental Cython wrapper around vtzero

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.7%
  • Makefile 1.3%