mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
With -pn, give area covered by more than one polygon to the earliest
Consistent snapping keeps the borders of polygons in a layer from crossing, but where rounding turned a narrow polygon between two others inside out (for example, a Census block thinner than a pixel whose two sides cross when rounded to tile coordinates), the area it covered is covered by both of its neighbors, and snapping can't decide which of them it belongs to. So after cleaning the polygons of each layer, find the ones that overlap: two polygons that share an edge in the same direction both cover the area beside it (neighbors that tile exactly traverse their shared border in opposite directions), and where their borders don't share any edges, a vertex of one is strictly inside the other. Then remove each overlapping area from all but the polygon with the lowest sequence number, using the layer's hot pixels so the result stays consistent with the rest. For Dane County Census blocks at -D8 -d8 -pt -pn, this reduces the overlapping pixels at z8, z9, and z10 from 41, 61, and 61 to 7, 8, and 16, without changing the gaps much or taking noticeably longer, and with no self-intersecting polygons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
@@ -57,4 +57,13 @@ hot_pixel_list layer_hot_pixels(std::vector<drawvec const *> const &geoms);
|
||||
// from layer_hot_pixels() as well as its own. Sets *ok to false if that fails.
|
||||
drawvec clean_polygon_with_hot_pixels(drawvec const &geom, hot_pixel_list const &hot, bool *ok);
|
||||
|
||||
// Polygons (in tile coordinates, in order of priority) that have been cleaned
|
||||
// with consistent snapping should tile without crossing, but where rounding
|
||||
// turned a narrow polygon between two others inside out, the area it covered
|
||||
// may be covered by both of its neighbors. Remove each such overlapping area
|
||||
// from all but the first of the polygons that cover it. Returns how many
|
||||
// polygons were changed.
|
||||
// `hot` is the hot pixels of the layer, from layer_hot_pixels(), if any.
|
||||
size_t remove_overlaps(std::vector<drawvec *> const &geoms, hot_pixel_list const *hot);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user