mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
With -pn, snap-round each layer's polygons consistently with each other
Wagyu snaps each edge to every "hot pixel" (vertex or rounded intersection) that it passes through. Each polygon was cleaned on its own, with only its own hot pixels, so a border shared by two polygons could be bent through a hot pixel in one of them and not in the other, leaving a shard gap or overlap between them even though --no-simplification-of-shared-nodes had simplified and rounded the border identically in both. (In Dane County tile 11/515/751, rounding moved one of a block's own vertices across its border with a sliver, and cleaning bent the block's copy of the border through a hot pixel that the sliver's copy didn't have.) Wagyu now has hot_pixels(), which returns the hot pixels of the rings added to it, and add_hot_pixels(), which gives execute() more hot pixels to snap to. When extra hot pixels are given, edges are snapped to every hot pixel they touch, including corner touches, so that whether a shared edge is snapped to a hot pixel can't depend on which polygon it is in. With -pn, the simplification worker now runs in two passes. The first simplifies and rounds every feature in the tile. Then the hot pixels of all the polygons in each layer are found together, which also finds crossings between features that no single feature would see. The second pass cleans each polygon with the layer's hot pixels near it as well as its own, so the borders it shares are snapped identically in each polygon. This is snap rounding of the whole layer's arrangement at once, so the result is still free of crossings. For Dane County Census blocks at -D8 -d8 -pt -pn, tiles 12/1031/1503 and 11/515/751 now have no gaps between blocks (from 10 and 23 pixels), and the gaps and overlaps at z9 and z10 go from 55/113 and 155/175 to 13/56 and 23/59 pixels, with no self-intersecting polygons. Natural Earth 10m countries at -z8 -pn take about 7% longer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
@@ -36,6 +36,18 @@
|
||||
borders that the polygon shares with other features, and a polygon whose
|
||||
borders are all shared is left out entirely, so that its neighbors close
|
||||
over the space instead of being overlapped.
|
||||
* With --no-simplification-of-shared-nodes, snap-round the polygons of each
|
||||
layer in a tile consistently with each other. Wagyu snaps each edge to the
|
||||
"hot pixels" (vertices and rounded intersections) that it passes through,
|
||||
but each polygon was cleaned on its own, with only its own hot pixels, so a
|
||||
border shared by two polygons could be bent through a hot pixel in one of
|
||||
them and not the other, leaving a shard gap or overlap between them. Now the
|
||||
hot pixels of all the polygons in the layer are found first, and each polygon
|
||||
is snapped to the ones near it as well as its own, so shared borders are
|
||||
snapped identically. For Dane County Census blocks at -D8 -d8 -pt -pn, this
|
||||
reduces the gaps between blocks at z9 and z10 from 55 and 155 pixels to 13
|
||||
and 23, and the overlaps from 113 and 175 to 56 and 59, and takes about 7%
|
||||
longer for Natural Earth countries at -z8 -pn.
|
||||
* Fix Wagyu's snap rounding so that an edge that intersects no other edge
|
||||
is no longer snapped to a hot pixel whose corner it only touches, unless
|
||||
that hot pixel is the rounded location of an intersection. Previously, two
|
||||
|
||||
Reference in New Issue
Block a user