Skip to content

feat(borders): use mapcode-ts-borders for border lookups - #12

Merged
rijnb merged 6 commits into
mainfrom
feat/mapcode-ts-borders
Nov 1, 2026
Merged

rijnb merged 6 commits into
mainfrom
feat/mapcode-ts-borders

Conversation

@rijnb

@rijnb rijnb commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Why

The service did its own OpenStreetMap border lookups with a FlatGeobuf file, flatgeobuf and flatbush. The same lookups now live in the mapcode-ts-borders package, so this service uses that package and deletes its own copy.

What changed

  • Border lookups, mapcode ranking and the recording country now come from mapcode-ts-borders 1.0.0. BoundaryService, flatgeobuf and flatbush are removed.
  • The service always uses the border data in the package (OpenStreetMap, May 2026) and logs the snapshot at startup. MAPCODE_BORDERS_PATH is no longer used, and the 4 data/*.fgb files are removed.
  • The test fixture now uses real territory codes, because the package rejects unknown codes. The version is 2.12.0.

Scope

  • Covers the service, its tests and the docs.
  • API responses do not change.
  • New border data comes with a new mapcode-ts-borders release and a dependency bump.

Blast Radius

Deployments need no config change. A MAPCODE_BORDERS_PATH that is still set is ignored, so it can be removed at any time.

Verification

  • npm test passes 746 tests. Only 2 expectations changed, both for renamed fixture codes.
  • Main and this branch gave byte-identical responses for 140,000 handler calls: 20,000 points, half of them near border vertices, with default, include, local, mapcodes, country and territory variants, plus the territories endpoint.
  • npm run start with a .env that still sets MAPCODE_BORDERS_PATH=./data/borders.fgb starts, logs borders: OpenStreetMap 2026-05 and answers requests.

🤖 Generated with Claude Code

rijnb and others added 6 commits November 1, 2026 14:41
Replace the in-house FlatGeobuf/flatbush BoundaryService with
mapcode-ts-borders 1.0.0. MAPCODE_BORDERS_PATH is now optional and
defaults to the bundled data. The test fixture is rebuilt as an .mcb
file with canonical territory codes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The service reads its borders from mapcode-ts-borders, so the data/*.fgb
files are gone. README and .env.example describe the optional
MAPCODE_BORDERS_PATH and add the 2.12.0 release notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is missing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rijnb
rijnb merged commit 3718761 into main Nov 1, 2026
1 check passed
@rijnb
rijnb deleted the feat/mapcode-ts-borders branch November 1, 2026 13:55
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