From ba697ab3b129caeabd5e4c5afac3c0d15306a10a Mon Sep 17 00:00:00 2001 From: jross Date: Wed, 8 Jul 2026 12:09:34 -0600 Subject: [PATCH] Fix overlapping county borders in well-density-by-county _make_shape applied poly.simplify(0.1) (~11 km tolerance) to each county polygon independently. Adjacent counties share exact boundary vertices in the geoconnex source data, so simplifying each one separately moved those shared vertices in different directions, making neighboring county borders overlap (and gap). This showed up as artifacts in the well-density-by-county view. Drop the simplification and use the full-resolution source geometry. Shared borders stay coincident, so counties tile cleanly. Verified: all 33 NM county pairs now have zero pairwise overlap (previously several overlapped, e.g. Chaves-Eddy). Full-resolution WKT remains compact (~1 KB per county), so spatial-filter query size is unaffected. Co-Authored-By: Claude Opus 4.8 --- backend/bounding_polygons.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/bounding_polygons.py b/backend/bounding_polygons.py index 1bd53a67..4bf305b4 100644 --- a/backend/bounding_polygons.py +++ b/backend/bounding_polygons.py @@ -83,8 +83,13 @@ def get_state_polygon(state: str, buffer: int | None = None): # private helpers ============================ def _make_shape(obj, as_wkt): + # Use the full-resolution source geometry. Do NOT simplify: adjacent + # counties share exact boundary vertices in the source data, so any + # per-county simplification moves those shared vertices independently and + # makes neighboring county borders overlap (or gap). Keeping full + # resolution guarantees shared borders stay coincident. See fix for the + # "well density by county" overlap artifact. poly = shape(obj["geometry"]) - poly = poly.simplify(0.1) if as_wkt: return poly.wkt return poly