Skip to content

fix(generator): place receivers on land using Natural Earth coastline#1

Open
VladKochetov007 wants to merge 1 commit into
mainfrom
fix/nodes-in-water
Open

fix(generator): place receivers on land using Natural Earth coastline#1
VladKochetov007 wants to merge 1 commit into
mainfrom
fix/nodes-in-water

Conversation

@VladKochetov007

Copy link
Copy Markdown

Problem

Synthetic receivers (and their display-fuzzed map positions) landed in the ocean — e.g. synth-US nodes off Pacifica, Sydney TCN-9 in the Pacific.

Cause

RX positions were water-rejected only by a handful of coarse US bounding boxes. Coastal points fell through the gaps (Pacifica sat between the Pacific box and the SF-bay box), the frontend display-fuzz (±~400 m) drew the dot in water even when the real RX was on land, and Sydney had a latitude sign error.

Fix

shapely + Natural Earth land check (_get_land_check): a point is water if it is outside every land polygon (ne_10m_land) or inside an inland lake (ne_50m_lakes), via lazily-built STRtree lookups. _place_rx_on_land now validates both the real RX and the display-fuzzed position, with random / spiral / curated-coastal fallbacks. The old US bounding boxes remain only as a fallback when shapely or the data is unavailable. Sydney latitude sign fixed.

Cost / footprint

~120 MB RAM, ~0.5 s, lazy (only during fleet generation, released after), ~11 MB bundled GeoJSON. Replaces the rejected global-land-mask (921 MB, always resident).

Verified

0 water nodes across the deploy config (api=True, seed 42, 200/us, 8×1), real and display positions. Tests: 30 passed.

Note

Adds shapely>=2.0 dependency and bundles two GeoJSON layers as package data (Dockerfile pip install ships them to deploy).

Receivers were positioned by distance/bearing from the tower with only coarse
US bounding-box water rejection, so coastal and display-fuzzed positions could
fall in the ocean (synth-US nodes off Pacifica; Sydney TCN-9 sat in the Pacific
from a latitude sign error).

Add a shapely + Natural Earth land check (_get_land_check): a point is water if
it is outside every land polygon (ne_10m_land) or inside an inland lake
(ne_50m_lakes), via STRtree lookups built lazily on first use. _place_rx_on_land
now validates both the real RX position and the frontend display-fuzzed position
(nodes are drawn at the fuzzed location), with random, spiral, and curated
coastal-land fallbacks. The old US bounding boxes remain only as a fallback when
shapely or the data is unavailable. Fix the Sydney latitude sign.

Bundle the two Natural Earth GeoJSON layers as package data and add the shapely
dependency so the check ships to deploy. ~120 MB RAM, ~0.5 s, lazy-loaded.
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