Repository navigation
Conversation
A new internal package that places a position in a named area drawn in a GeoJSON file: Polygon and MultiPolygon with holes, [lon, lat] order, a layer per feature, the smallest area of a layer winning where areas overlap, airport codes for observers without a position, and unique codes across layers. Stubs only; every test fails on its assertions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
ParseGeoJSON reads a FeatureCollection (Polygon and MultiPolygon, holes respected, [lon, lat] order); each feature's properties give its code, label, layer (default "region") and the airport codes of observers that report no position. New refuses a code used twice, in any layer. Locate checks each polygon's bounding box first, then the even-odd test on its outer ring and holes, and returns the smallest containing area of the layer, so nested areas resolve to the most specific. Size is the shoelace area with longitude scaled by latitude: enough to order overlaps. BenchmarkLocate (six areas of 2,000 vertices): 2.1 us/op, 0 allocs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
areasFile names a GeoJSON FeatureCollection next to config.json. Its areas join config.json's (converted from their [lat, lon] order) in one map kept on the config; a code in both, a missing file or bad JSON are refused. /api/config/areas lists file areas with their layer, and area= accepts a file area's code. Stubs only: the tests fail on their assertions. Also wires internal/areamap into the server module and the Dockerfile, and adds Map.Has to the package (red there too). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
config.json's areas are one polygon or box each, which cannot hold a
coastline, islands or a hole. areasFile names a GeoJSON FeatureCollection
beside config.json whose features become areas too: Polygon and
MultiPolygon with holes, a layer per feature, airport codes for observers
that report no position.
- LoadAreaMap builds one map from config.json's areas (layer "region",
converted from their [lat, lon] order) and the file, and keeps it on the
config. A code in both, a missing file or bad GeoJSON stops startup with
the reason, rather than running with areas silently missing.
- /api/config/areas lists file areas after config.json's, each entry now
carrying its layer ("region" for config.json areas). Additive: existing
fields unchanged.
- area= accepts a file area's code, matched by node position against its
geometry through the same cache. config.json areas keep their existing
polygon and box path unchanged.
Documented in config.example.json (areasFile + _comment_areasFile),
docs/api-spec.md, and an example file, docs/examples/areas.example.geojson,
which a test loads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H
This was referenced Oct 10, 2026
Owner
Author
|
Superseded by #16, which carries this as its own commits alongside the rest of the Data tab (one PR, as asked). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of six PRs for the Data tab. The plan is at https://claude.ai/artifact/PAJwg4KmQQ7Cp7nSDvyBo9.
This PR lets CoreScope load named areas from a GeoJSON file. They work wherever
areasalready works today, and later PRs build the Data tab's "origin area" on top of them. No UI changes are in this PR.What changes
internal/areamap(its own module, with the DockerfileCOPYline added):code(required),label,layer(defaultregion) and an optionaliatalist.Locate(layer, lat, lon)returns the smallest area that contains the point, so a city inside a country resolves to the city.(0,0)is never treated as a place.areasFile: a path to the GeoJSON file, relative to the config dir unless absolute. It is optional and empty by default.areasentries (bbox or polygon) are merged into the same map./api/config/areaslists file areas next to config areas, and each entry gains alayerfield.area=filter (nodes, packets, and so on) accepts file area codes through the same cached resolver.docs/examples/areas.example.geojson, aconfig.example.jsonentry, and theapi-spec.mdupdate.Tests
areamap: 846b0b6, then 1f59c9f.server: 4d72542, then b87f636.internal/areamaptests cover:HasandContains;cmd/servertests cover:/api/config/areasshowing layers;area=filtering on a file area;scripts/allmod.shpasses 17 of 17;check-dockerfile-internal-pkgs.shpasses.[areas] 2 areas in layers [region]./api/config/areasreturned BAY and MRY./api/nodes?area=BAYreturned only Bay Area nodes.Benchmark
The benchmark uses a three-area fixture, including a MultiPolygon with a hole. A bounding-box check runs before the ring test.
Gate
areasFileunset, the code paths behave as before.areastake the existingPassesFilterroute.areas.geojson.🤖 Generated with Claude Code
https://claude.ai/code/session_01KaR4xu8gVykQBkH8yG8m6H