With -pn, union spindle strips in the same pass that cleans each polygon

With consistent snapping, each polygon was cleaned with the layer's hot
pixels, but then its spindle strips (if it had any) were unioned with it
in a separate pass, which snapped the whole polygon to tile coordinates a
second time. Snapping already-snapped geometry doesn't necessarily leave it
the same, and the neighbors it shares borders with weren't snapped again to
match. In Dane County tile 12/1027/1502, a narrow water channel's strips
were added where it crossed the edge of the tile's buffer, and that second
pass bent its border with the block next to it, far from the strips,
through the hot pixel at (11, 249), so their edges crossed and overlapped.

So include the rounded strips of every polygon in the layer's hot pixels,
and union each polygon with its strips (with the non-zero fill rule, as
before) in the same wagyu pass that cleans it, so that every polygon is
snapped exactly once, consistently with its neighbors, including where
strips meet other polygons.

For Dane County Census blocks at -D8 -d8 -pt -pn -zg, this reduces the
number of polygons whose overlaps have to be removed afterwards from 2732 to
2482, and the number that are still changing after 4 rounds of overlap
removal from 156 to 14, with still no points covered by more than one
polygon at z8 to z12.

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-12-01 03:29:02 +00:00
parent c7f45ee81d
commit 91a3ff99f8
7 changed files with 82 additions and 62 deletions
+9 -3
View File
@@ -59,9 +59,15 @@
overlapping area is removed at a higher resolution than the tile, so that
the polygon isn't snapped to tile coordinates a second time, which could
collapse parts of it that the first snapping had left, and leave holes.
Where spindle strips made two polygons' edges cross, removing the overlap
has to snap the crossing to tile coordinates, which can leave a smaller
overlap, so this is repeated until no overlaps are left (at most 4 times). For Dane County Census blocks at -D8 -d8 -pt -pn, this
Where two polygons' edges still cross, removing the overlap has to snap
the crossing to tile coordinates, which can leave a smaller overlap, so
this is repeated until no overlaps are left (at most 4 times).
* In this mode, the spindle strips are unioned with each polygon in the same
pass that cleans it, and their hot pixels are included in the layer's, so
every polygon is snapped only once. Unioning the strips afterwards snapped
the whole polygon a second time, which could bend its borders differently
from those of the neighbors it shares them with, which weren't snapped
again, so that their edges crossed. 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.