Grandine: Vector Tiles, Summary May 2017

Continuation of the documentation of my Prototype Fund related work. Previous summaries: March, April

Decoding/Encoding TWKB

In the April summary I briefly discussed the TWKB format, but wanted to implement it either way, because it might be useful some day in the still unnamed new geo data format. This has been completed so far and supports all features that are supported by my spatial lib.

Data format library

Before, the encoding of the intermediate data format was very procedural style. This has changed in the last week, as it is now separated into a library and the GeoJSON converter just uses the exported functions. As a result, the converter is now less than a 100 lines of code and the whole complexity is now nicely wrapped.


I started diving into the Mapbox Vector Tile Specification and hope to start implementing it in the next weeks. But before…

Geometry operations

Before I can build tiles, I need to be able to cut geometries on tile borders. Before reading some algorithms, I tried to implement it on my own and failed miserably. Well, maybe not completely, but I haven’t envisioned some nasty edge-cases.

I started implementing the Weiler-Atherton algorithm for clipping polygons. Aside from minor troubles in case of some polygons, the clipping algorithm is pretty much complete. Annoyingly Weiler-Atherton requires the polygon rings to be ordered in clockwise order, so I had to implement this as well.


As a bonus I set up Travis CI for the Grandine repo, so I will be notified if a test or build fails. Just in case.

to be continued