mapnik/node-mapnik — pull request #214 by springmeyer (2014-02-14 23:15:47+00:00)
Title: Lazy VT parsing + experimental VT compositing

This radically changes the internal behavior of `mapnik.VectorTile` for handling protobuf encoded buffers and also brings public API changes.

- Now `vt.setData` does not internally parse the data but simply copies the raw buffer to a bytearray that are then owned by the VectorTile object. This means that vt.setData as sync is likely faster than the async version because memory allocation can be slower in threads.

- Now vt.parse() is needed before working with the data except if you only want to composite one VT with another or you want to access `vt.names()`. These two operations are lazy and therefore do not need a `vt.parse()`, but all other access on the VT object does. So if in double `vt.parse()` must now follow `vt.setData`. This adds complexity at the cost of major performance gains for operations that can lazily operate on the protobuf buffer. While current this is just `vt.names()` other operations may in the future become lazy and therefore `vt.parse()` will not be required.

- Adds a vt.composite() function that takes an array of other vector tiles and either appends (if z/x/y matches parent) or re-renders and appends (if z/x/y differs)

Remaining todo/followups on this will be tracked at #209.