mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
Replace polygons that collapse entirely with their outlines, not rectangles
When a polygon collapsed away to nothing during cleaning, revive_polygon() replaced it with a rectangle with the polygon's area, centered on the average of its vertices. That looked bad for two reasons. Most polygons that collapse are much smaller than a pixel, and the rectangle is at least a pixel, so it was usually far too big: for Dane County Census blocks at -D8 -d8 -pt -pn, 88% of the 27,206 revived polygons had less than half a pixel of area, and the median rectangle had 11 times the area of the polygon it replaced. And the larger polygons that collapse are almost all long and narrow, like blocks between roads, so a square at their midpoint looked nothing like them. Now a polygon that collapses entirely is first replaced by the union of one-pixel strips along every edge of its simplified outline, which traces its shape in the right place. Only if that is empty too, because the whole polygon is within a pixel or so, is it replaced by the rectangle, which is then a single pixel. This is part of spindle preservation, so with --no-spindle-preservation the rectangle is still used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
@@ -532,7 +532,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Uganda" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 34.497070, 3.513421 ], [ 34.584961, 3.074695 ], [ 35.024414, 1.889306 ], [ 34.672852, 1.186439 ], [ 33.881836, 0.131836 ], [ 33.881836, 0.000000 ], [ 33.925781, -0.966751 ], [ 30.761719, -1.010690 ], [ 29.838867, -1.450040 ], [ 29.575195, -1.362176 ], [ 29.575195, -0.571280 ], [ 29.838867, -0.219726 ], [ 29.838867, 0.000000 ], [ 29.882812, 0.615223 ], [ 30.102539, 1.054628 ], [ 30.454102, 1.581830 ], [ 30.849609, 1.845384 ], [ 31.157227, 2.196727 ], [ 30.761719, 2.328460 ], [ 30.849609, 3.513421 ], [ 34.497070, 3.513421 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "S. Sudan" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 30.805664, 3.513421 ], [ 30.849609, 3.513421 ], [ 30.849609, 3.469557 ], [ 30.805664, 3.469557 ], [ 30.805664, 3.513421 ] ] ] } }
|
||||
{ "type": "Feature", "properties": { "name": "S. Sudan" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 30.849609, 3.557283 ], [ 30.849609, 3.469557 ], [ 30.805664, 3.469557 ], [ 30.805664, 3.557283 ], [ 30.849609, 3.557283 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "Ethiopia" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 38.891602, 3.557283 ], [ 39.243164, 3.513421 ], [ 39.638672, 3.513421 ], [ 39.638672, 3.469557 ], [ 39.594727, 3.469557 ], [ 39.550781, 3.425692 ], [ 39.243164, 3.469557 ], [ 38.891602, 3.469557 ], [ 38.891602, 3.557283 ] ] ] } }
|
||||
,
|
||||
|
||||
Reference in New Issue
Block a user