Skip to content

Clean WAB map GeoJSON: land-only squares, fix CRS overlaps - #3467

Open
magicbug wants to merge 3 commits into
masterfrom
cursor/clean-wab-squares-geojson-b4b2
Open

Clean WAB map GeoJSON: land-only squares, fix CRS overlaps#3467
magicbug wants to merge 3 commits into
masterfrom
cursor/clean-wab-squares-geojson-b4b2

Conversation

@magicbug

@magicbug magicbug commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

Regenerates assets/json/WABSquares.geojson from master for official Worked All Britain (WAB) award territory, fixing sea-only squares, France/ROI leakage, Irish/OSGB polygon overlaps, large 100 km boundary clutter, and a Leaflet regression in MultiLineString coordinate nesting.

Replaces unfinished Copilot draft #3405 (not based on that branch).

WAB scope (evidence)

Per WAB Definitions and WAGI Award:

Territory Grid system In this file
Great Britain (England, Scotland, Wales) OSGB EPSG:27700 Yes
Northern Ireland only Irish Grid EPSG:29902 Yes
Channel Islands UTM 30N EPSG:32630 Yes
Republic of Ireland WAI (IRTS, separate award) No
Mainland France Not WAB No

Republic of Ireland Irish Grid squares and 17 French Channel-coast OSGB cells (TW10, TW21, …) from the prior revision are removed.

Method

  1. Grid generation (osbng + Irish/UTM logic aligned with kwirk/pota-gb-map)
  2. Land filter: OSM land-polygons (captures Scottish islands Natural Earth admin omits)
  3. Territory filter: Natural Earth admin — GB qualifying land = OSM land minus NI/France/ROI/CI; reject OSGB cells with land only in France outside WAB admin (Calais/Dover coast); Irish Grid only where land intersects NI; CI only Jersey/Guernsey
  4. Overlap fix: Clip OSGB squares by subtracting foreign territories; clip Irish to NI; clip CI to CI — 0 cross-grid polygon overlaps (was 1,067 when both grids covered Ireland)
  5. Leaflet fix: MultiLineString coordinates changed from invalid [[ring]] (4 levels) to [ring] (3 levels) matching master and RFC 7946

Counts

Metric master Prior PR rev This rev
Square labels 5,629 3,827 3,141
GeoJSON features 11,313 7,654 6,282
Large 100 km boxes 55 0 0
File size 7.64 MiB 5.70 MiB 4.43 MiB
OSGB ~5,229 3,468 2,944
Irish Grid 400 (incl. ROI) 330 184 (NI only)
Channel Islands 29 13
Cross-grid polygon overlaps many 0 coord dups only 0
France-only squares present 17 (TW*) 0

Regression fix: Leaflet Invalid LatLng

boundary_and_point() emitted coordinates: [[list(ring)]], nesting the entire ring as one “position” so Leaflet saw 4-tuples like (-6.31, 49.90, -6.31, 49.81).

Fix: coordinates: [ring] where ring = [[lon, lat], …] — same 3-level nesting as master.

Validation

python3 scripts/generate_wab_squares.py   # regenerates + territory checks
python3 scripts/validate_wab_geojson.py # RFC 7946 / nesting / bounds
node scripts/test_wab_geojson_leaflet.js # Leaflet-style LatLng parse

Generator asserts: required islands, no cross-grid overlaps, no France-only/ROI-only squares, no duplicate names/coordinates.

Verified squares

  • NL57, NL58, HW83 — retained (OSM land + foreign-subtract clip; Natural Earth admin alone drops these)
  • WV65 and 12 CI squares — retained
  • TW10 and other France-only coast cells — removed

Out of scope

Open in Web Open in Cursor 

cursoragent and others added 3 commits September 2, 2026 17:26
Regenerate WABSquares.geojson from master using correct grid projections
(OSGB EPSG:27700, Irish Grid EPSG:29902, Channel Islands UTM EPSG:32630)
and OSM land-polygons for sea filtering. Removes 55 large 100 km boundary
boxes, sea-only squares, and seven Irish/GB coordinate duplicates caused
by mixed CRS (e.g. D96/NS11). Retains Scottish island squares NL57, NL58,
HW83 without padding entire letter prefixes.

Co-authored-by: Peter Goodhall <magicbug@users.noreply.github.com>
Added `wab` to the awards route checks used by `header.php`, `mini_header.php`, and `footer.php` when deciding whether to load Leaflet scripts/styles. This ensures map-related assets are available on the WAB awards view just like other map-enabled award pages.
- Restrict to official WAB territory: GB (OSGB), Northern Ireland (Irish
  Grid), Channel Islands (UTM); exclude ROI and France-only coast cells
- Assign grids by territory: OSGB clipped by subtracting NI/France/ROI/CI;
  Irish Grid clipped to NI; use OSM land for Scottish islands missed by
  Natural Earth admin polygons
- Fix MultiLineString coordinates from [[ring]] to [ring] matching master
  and RFC 7946 (fixes Leaflet Invalid LatLng)
- Add validate_wab_geojson.py and test_wab_geojson_leaflet.js

Co-authored-by: Peter Goodhall <magicbug@users.noreply.github.com>
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.

2 participants