mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
With -pn, don't add spindle strips that would overlap neighboring features
A spindle strip extends one pixel past the far side of the narrow part it preserves, so a panhandle between two neighboring features (or any narrow part whose far side borders another feature) would overlap its neighbors by up to a pixel, which is unfortunate for datasets that are meant to tile exactly. With --no-simplification-of-shared-nodes, the vertex pass already sorts every polygon vertex with its neighbors to find the shared nodes. Each vertex record now also carries the feature it came from, and the same pass writes out each edge that is part of two or more different polygon features, as a sorted table of half-edges. When a narrow edge's strip would extend past an edge that is in that table, the strip is left out, so the panhandle collapses as it used to and the features still tile exactly. A narrow part with open space on its far side, like a coastal strip whose other side is a shared border, still gets the strip along its shared side, which extends away from the neighbor. The table is only searched for edges that have already been found to be narrow, not for every vertex, and since simplification may have removed vertices along a shared border, an edge counts as shared if a shared edge leaves either of its endpoints in its direction, within the simplification tolerance. On a synthetic tiling (tests/spindle-shared), spindle preservation with -pn adds no overlapping pixels at all compared to --no-spindle-preservation, while without -pn the same data overlaps by several hundred pixels per zoom level. On ne_10m_admin_0_countries -z8 -pn, the time difference is within noise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
+3
-2
@@ -525,7 +525,8 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std::
|
||||
struct vertex v(
|
||||
scaled_geometry[(k - i + 0) % (j - i - 1) + i],
|
||||
scaled_geometry[(k - i + 1) % (j - i - 1) + i],
|
||||
scaled_geometry[(k - i + 2) % (j - i - 1) + i]);
|
||||
scaled_geometry[(k - i + 2) % (j - i - 1) + i],
|
||||
*(sst->layer_seq));
|
||||
|
||||
fwrite_check((char *) &v, sizeof(struct vertex), 1, r->vertexfile, &r->vertexpos, sst->fname);
|
||||
}
|
||||
@@ -676,7 +677,7 @@ int serialize_feature(struct serialization_state *sst, serial_feature &sf, std::
|
||||
} else if (extent < 0) {
|
||||
sf.extent = LLONG_MIN;
|
||||
} else {
|
||||
sf.extent = LLONG_MAX; // also the NaN case
|
||||
sf.extent = LLONG_MAX; // also the NaN case
|
||||
}
|
||||
|
||||
if (sst->want_dist && sf.t == VT_POLYGON) {
|
||||
|
||||
Reference in New Issue
Block a user