mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
With -pn, let neighbors close over polygons that collapse entirely
A polygon that collapses away entirely is replaced by its outline, but with --no-simplification-of-shared-nodes that outline overlaps the neighboring features along every shared border, and those features already cover the space. So leave the shared borders out of the outline, as the spindle strips already do, and if every border is shared, leave the polygon out entirely instead of falling back to a rectangle. For Dane County Census blocks at -D8 -d8 -pt -pn, this reduces the overlapping pixels in tile 12/1031/1503 from 141 to 11 and in 11/515/751 from 915 to 38, and the number of revived rectangles at z8 from 6307 to 1414, at the cost of a few more one-pixel gaps (7 to 10 and 14 to 23) where a block of less than a pixel is left out and its neighbors' borders don't round to the same line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
@@ -718,13 +718,23 @@ static void *simplification_worker(void *v) {
|
||||
// which keeps its shape and location. Only if that too is empty,
|
||||
// because the whole polygon is within a pixel or so, fall back to
|
||||
// a rectangle with the polygon's area (but at least a pixel).
|
||||
//
|
||||
// But with --no-simplification-of-shared-nodes, a polygon whose
|
||||
// borders are all shared with other features is left out instead,
|
||||
// so that its neighbors close over the space without overlapping.
|
||||
geom.clear();
|
||||
bool all_shared = false;
|
||||
if (world.size() > 0) {
|
||||
geom = union_polygon_strips(drawvec(), outline_strips(world, z, out_detail));
|
||||
geom = union_polygon_strips(drawvec(), outline_strips(world, z, out_detail, (*features)[i]->simplification,
|
||||
(long long) (*features)[i]->tx << (32 - z), (long long) (*features)[i]->ty << (32 - z), &all_shared));
|
||||
}
|
||||
if (geom.size() < 3) {
|
||||
// area is in world coordinates, calculated before scaling down
|
||||
geom = revive_polygon(before, area, z, out_detail);
|
||||
if (all_shared) {
|
||||
geom.clear();
|
||||
} else {
|
||||
// area is in world coordinates, calculated before scaling down
|
||||
geom = revive_polygon(before, area, z, out_detail);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
geom.clear();
|
||||
|
||||
Reference in New Issue
Block a user