Skip to content

fix: repair the three coordinates blocking migration 23 - #13

Merged
keonik merged 1 commit into
mainfrom
fix/reproject-state-plane
Sep 14, 2026
Merged

fix: repair the three coordinates blocking migration 23#13
keonik merged 1 commit into
mainfrom
fix/reproject-state-plane

Conversation

@keonik

@keonik keonik commented Sep 14, 2026

Copy link
Copy Markdown
Owner

/health named the rows it could not place, which is the only reason these
were diagnosable without database access:

id=565923   county=Darke      at (1416737.6505, 811329.7090)
id=1799534  county=Jefferson  at (-0.0001, 0.0001)
id=5166691  county=Miami      at (1513448.6481, 690888.3803)

Two are mis-projected, not junk

Those are Ohio State Plane South in US survey feet, loaded without ever
being reprojected. A longitude cannot exceed 180, so they are unambiguously not
degrees.

The CRS was not guessed. Every candidate was tested against the real county
polygons:

565923 (Darke) via Ohio North ftUS -> 41.87592, -84.52606
565923 (Darke) via Ohio South ftUS -> 40.21093, -84.47560   <== INSIDE its named county
565923 (Darke) via Ohio North m    -> 46.51347, -71.88000
565923 (Darke) via Ohio South m    -> 44.87658, -72.18918

Only EPSG:3735 lands each row inside the county it already claims. Michigan,
Maine and Quebec are the alternatives.

That corroboration is load-bearing, not decorative. The migration applies
the repair only where the reprojected point falls inside the row's named
county — a row whose county disagrees is left alone rather than moved somewhere
plausible-looking. There is a test for exactly that case.

The third has no recoverable location

(-0.0001, 0.0001) is Null Island, the placeholder a missing coordinate
becomes. But it names a real Ohio county, and ohio_counties holds only Ohio
counties — so a name match there is evidence of the state even when the point
is worthless.

Its region is attributed; its coordinates are left wrong, where they now surface
under outside_us_bounds on /admin/data-quality. A bad location belongs in a
data-quality report, not blocking a uniqueness migration.

Verified end to end

Replayed against a database holding the real 88 county polygons with all three
rows as production has them:

before: sp-darke at (1416737.6505, 811329.7090) region=<null>
        sp-miami at (1513448.6481, 690888.3803) region=<null>
        sp-null  at (-0.0001, 0.0001)           region=<null>

after:  sp-darke at (-84.4756, 40.2109)  region=OH
        sp-miami at (-84.1217, 39.8857)  region=OH
        sp-null  at (-0.0001, 0.0001)    region=OH

        applied schema version = 23

This should be the one that lets migration 23 complete.

🤖 Generated with Claude Code

/health named the rows that could not be placed, which is what made diagnosing
them possible without database access:

  id=565923  county=Darke     at (1416737.6505, 811329.7090)
  id=1799534 county=Jefferson at (-0.0001, 0.0001)
  id=5166691 county=Miami     at (1513448.6481, 690888.3803)

Two are Ohio State Plane South in US survey feet, loaded without ever being
reprojected. A longitude cannot exceed 180, so they are unambiguously not
degrees. Reprojected from EPSG:3735 both land inside their own named county
polygons; Ohio North and both zones in metres put them in Michigan, Maine and
Quebec. That corroboration is the evidence, and the migration applies the
repair only where it holds -- a row whose county does not agree is left alone
rather than moved somewhere plausible-looking.

The third sits at Null Island, the placeholder a missing coordinate becomes,
while naming a real Ohio county. ohio_counties holds only Ohio counties, so a
name match there is evidence of the state even when the point is worthless. Its
region is attributed and its coordinates are left wrong, where they now show up
under outside_us_bounds on /admin/data-quality. A bad location belongs in a
data-quality report, not blocking a uniqueness migration.

Replayed against a database holding the real 88 county polygons and all three
rows as production has them: both State Plane rows reproject into their
counties, the Null Island row takes OH from its county, and migration 23
completes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@keonik
keonik merged commit 743a0b4 into main Sep 14, 2026
3 checks passed
@keonik
keonik deleted the fix/reproject-state-plane branch September 14, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant