Consider this WKT geometry: LINESTRING (1 1, 0 0). The vector_tile encoding would be [9 1 1 17 -1 -1] (moveto 1,1; lineto 0,0), but negative deltas can't be stored in the geometry field as it's of uint32 type (repeated uint32 geometry = 4 [ packed = true ];).
Yes, zigzag encoding allows us to store positive and negative values. The specification as uint32 is merely a hint to the decoder; we're putting our own decoding step on top of protobuf's decoding.
Consider this WKT geometry:
LINESTRING (1 1, 0 0)
. The vector_tile encoding would be[9 1 1 17 -1 -1]
(moveto 1,1; lineto 0,0), but negative deltas can't be stored in the geometry field as it's of uint32 type (repeated uint32 geometry = 4 [ packed = true ];
).@springmeyer @kkaefer by "zigzag" do we mean replace all deltas n by
(n << 1) ^ (n >> 31)
as described in https://developers.google.com/protocol-buffers/docs/encoding? That would give a vector_tile encoding of[9 2 2 17 1 1]
.