mapbox/tilelive.js — pull request #88 by yhahn (2014-10-02 03:42:04+00:00)
Title: Pyramid onlyempty

This branch removes the shortcut in the pyramid stream which tries to reuse a solid parent tile for its children without refetching the child tiles. Only affects solid tiles which contain content -- empty tiles are still skipped per usual.

---

**Explanation**

Suppose we are rendering a tile at the very edge of a polygon that is rectangular.

|............
|............
+-----+......
tile |.....|......
|.....|......
+-----+......
|............
|.polygon....

If this tile has a slight buffer the polygon will hang over the N/E/S edges and be flush with the W edge when clipped.

........
+-----+.
tile |.....|.
|.....|.
+-----+.
........

**Before**

This buffer (identified currently as "solid") was reused, resulting in four child tiles that look like this:

........ ........
+-----+. +-----+.
|.....|. |.....|.
|.....|. |.....|.
+-----+. +-----+.
........ ........

........ ........
+-----+. +-----+.
|.....|. |.....|.
|.....|. |.....|.
+-----+. +-----+.
........ ........

When rendered with a fill + stroke you'd see an extra edge because the polygon is flush with the W edge of the vector tile:

|......|......
|......|......
|......|......
|......|......
|......|......
|......|......
|......|......
|......|......

**After**

Instead of repeating the parent buffer we read all the child tiles as normal. The two child tiles on the right should have a W edge buffer overhang:

........ .........
+-----+. .+-----+.
|.....|. .|.....|.
|.....|. .|.....|.
+-----+. .+-----+.
........ .........

........ .........
+-----+. .+-----+.
|.....|. .|.....|.
|.....|. .|.....|.
+-----+. .+-----+.
........ .........

When these tiles are rendered with a slight line stroke you'll get this

|.............
|.............
|.............
|.............
|.............
|.............
|.............
|.............

-------

Potential future solutions are to make the upstream solid detection in `node-mapnik` more clever (e.g. look for square clipped polygons equidistant/outside the tile boundaries) but for now disable repeated use of tile buffers in pyramid scheme.

cc @springmeyer @makella