Preserve spindle polygons as one-pixel-wide strips instead of letting them collapse

A polygon (or part of a polygon) narrower than a tile pixel, like a
1-meter buffer around a long linestring, used to collapse away to nothing
at most zoom levels when it was rounded to tile coordinates, except for
scattered fragments wherever the rounding happened to keep its two sides
apart.

Now, before the geometry is rounded, thin_polygon_strips() looks for edges
that have an oppositely-directed edge less than sqrt(2) tile units away
(the most that rounding can move two boundaries toward each other) and
that is not just the other side of a corner (the two points must also be
far apart along the ring). Candidate pairs are found with a sweep over the
edges' bounding boxes, so polygons without narrow parts cost little more
than sorting their edges. Each narrow edge gets a one-unit-wide strip, one
side of which is the edge as it will be rounded and the other side of which
is offset one unit toward the polygon's interior, so the strips lie within
the polygon wherever it is already thick enough, and they are unioned with
the cleaned polygon. The union is done at 16x resolution, because the
strips from the two sides of a spindle are nearly coincident and wagyu's
own snap rounding would otherwise collapse them in places.

Long, narrow polygons whose perimeter is more than 8 times the tiny polygon
size are also no longer combined into tiny-polygon squares, so a spindle
stays visible down to the zoom level where it is shorter than that.

--no-spindle-preservation restores the old behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
Claude
2026-11-30 20:03:31 +00:00
parent a888304b19
commit 957b1cd9b9
79 changed files with 10076 additions and 9090 deletions
+17
View File
@@ -1,3 +1,20 @@
# 2.83.0
* Preserve "spindle" polygons, and the narrow parts of polygons, that are too
narrow to survive being rounded to tile coordinates. Previously something
like a 1-meter buffer around a long linestring would collapse away to nothing
at most zoom levels, except for scattered fragments wherever the rounding
happened to keep its two sides apart. Now, before rounding, Tippecanoe looks
for edges that have an oppositely-directed edge less than √2 tile units away
that is not just the other side of a corner, and unions a one-unit-wide strip
along each of them into the cleaned polygon, so the narrow parts come out as
continuous lines one (or sometimes two) units thick. Where a polygon is
already thick enough, the strips lie within it and change nothing. Long,
narrow polygons whose perimeter is more than 8 times the tiny polygon size
are also no longer combined into tiny-polygon squares, though they still
are once the zoom level is low enough that they are shorter than that.
`--no-spindle-preservation` restores the old behavior.
# 2.82.0
* Fix corruption of a JSON array when a non-final element was removed from it.