Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 3.4 KB

README.md

File metadata and controls

63 lines (40 loc) · 3.4 KB

Coanacatl

Coanacatl is a Python extension library for writing Mapbox Vector Tiles, wrapping Mapbox's Wagyu and vtzero libraries.

How to use it?

NOTE: This is pre-alpha proof-of-concept level software. I don't recommend you use this in production code yet!

tile_data = coanacatl.encode(layers, bounds, extents)

Where:

  • layers is either a dictionary containing features and name keys, with the features being a list of dictionaries containing geometry, properties and id entries. The geometry must be a Shapely geometry object, properties must be a dictionary, and id must be either None or a positive integer.
  • bounds is a 4-tuple containing the (min_x, min_y, max_x, max_y) bounding box of the tile.
  • extents is a positive integer giving the number of coordinates in the x and y directions of the tile, typically 4096.

Building and installing

You will need to install a C++11 build system and the GEOS library, e.g: if you are on Ubuntu or Debian:

sudo apt install build-essential libgeos-dev libboost-python-dev

You will also need the Shapely Python library. Install (with or without sudo depending on whether you're installing it globally or locally):

pip install shapely

NOTE: probably other stuff as well! Please file an issue if you find you need additional dependencies.

Please make sure that the git submodules are initialise and updated:

git submodule update --init --recursive

Then run the setup.py installation procedure:

python setup.py install

Current limitations

  • Only point, linestring, polygon and multi-versions of those are supported. Linear rings and geometry collections are currently not supported.
  • Property dictionary keys must be strings (or unicode), as per the MVT spec. Property dictionary values can be boolean, integer, floating point or strings.
  • There are very few tests!
  • Error checking of return values from the GEOS API is inadequate, and needs shoring up.
  • There needs to be a better way to return warnings/errors to the user, perhaps as a list of objects, so that the user can determine if it's enough to fail the tile or just log.

Contributing

Coanacatl welcomes contributions! If you find a bug, please look through the existing issues and, if you don't find something related, please file a new one. It helps if you can give as much detail as possible when writing an issue, particularly about the versions of software you are using. If you can reduce it to a reproducible test case, that's awesome and helps us a lot when we're trying to fix it!

To submit changes, please fork this project into your own organisation, make your changes on an appropriately-named branch, and submit a Pull Request. Thank you!

What's with the name?

"Coanacatl" is the Nahuatl word for snake meat, which seemed fitting as this is a Python wrapper around Wagyu. Plus some other trimmings, but I couldn't think of a way to work vtzero in there as well!