Skip to content

Draw US state borders on the standard map view - #914

Merged
patrickrb merged 1 commit into
devfrom
feat/map-us-states
Sep 26, 2026
Merged

patrickrb merged 1 commit into
devfrom
feat/map-us-states

Conversation

@patrickrb

Copy link
Copy Markdown
Owner

Why

Asked for: "we should draw the US states on the new map."

The redesign already ships us_states.json and strokes it — but behind a scale >= 3 zoom gate. That gate hides the layer in exactly the view a US operator gets: with a grid set and no decodes yet, the map auto-frames the operator at scale ~2.9, a hair under the threshold, so the state lines never appear.

US state borders at the standard map's default zoom

What changed

Zoom was the wrong thing to gate on. The map COVERs its card, so the same scale means very different detail in the two projections:

view longitude px/degree state layer
standard map, zoom 1 (whole world in the card) ~6.3 full
standard map, auto-framed on the operator (~2.9x) ~18 full
azimuthal disc, zoom 1 (whole globe in the card) ~2.8 off
azimuthal disc, pinched in ramps up fades in

stateBorderAlpha() ramps 0 → 1 between 3 and 6 px per degree, fed by EquirectViewport.pxPerLonDegree (standard) and azimuthalPxPerLonDegree() (disc). Fading rather than snapping keeps a pinch from popping a whole layer into existence. The stroke stays a shade under the national borders so the basemap hierarchy holds.

Thresholds are tuned against the real map card (~1000x1140 px on a 1080p phone), not a full-screen canvas — the unit tests assert against those measured dimensions.

Verification

  • testDebugUnitTest (full suite) — pass; MapRedesignTest gains 5 tests covering the ramp, its monotonicity, and both projections at their default views.
  • Installed on an emulator and confirmed visually at the standard map's default zoom (screenshot above; it is a 2x crop — at 1:1 the lines are subtler).

Not yet checked on real hardware — no phone was attached to this machine.

Follow-up (not in this PR)

UsStateLabels (two-letter abbreviations at state centroids) is already parsed and used by the QSO-sheet mini-map; dropping those onto this map at high zoom would be a small follow-up if you want them.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lbd9brnZDMCzipgsu9n8Xg

The Map redesign already loads us_states.json and strokes it, but behind a
`scale >= 3` zoom gate. That gate hides the layer in exactly the view a US
operator sees: with a grid set and no decodes yet, the map auto-frames the
operator at scale ~2.9 — a hair under the threshold — so the state lines
never appear.

Zoom was the wrong measure anyway. The map COVERs its card, so the same
`scale` means very different detail in the two projections: the standard map
spends ~6.3 px per degree of longitude at zoom 1 (the lower 48 are ~370 px
across — their borders read cleanly), while the azimuthal disc squeezes the
whole globe into the card at ~2.8 px per degree, where state outlines really
are noise.

Gate on that density instead, and fade rather than snap so a pinch doesn't
pop a whole layer into existence: stateBorderAlpha() ramps 0 -> 1 between 3
and 6 longitude px per degree, fed by EquirectViewport.pxPerLonDegree for the
standard map and azimuthalPxPerLonDegree() for the disc. Net effect: state
borders are on throughout the standard projection, still off on the azimuthal
world view, and the stroke stays a shade under the national borders so the
basemap hierarchy holds.

Verified on an emulator: state lines visible at the standard map's default
zoom (screenshot in the PR).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lbd9brnZDMCzipgsu9n8Xg
@codecov

codecov Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.10526% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.50%. Comparing base (c603d1c) to head (50285a9).

Files with missing lines Patch % Lines
...main/kotlin/radio/ks3ckc/ft8af/ui/map/MapScreen.kt 38.88% 11 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                dev     #914   +/-   ##
=========================================
  Coverage     41.50%   41.50%           
  Complexity      252      252           
=========================================
  Files           280      280           
  Lines         33973    33986   +13     
  Branches       4033     4034    +1     
=========================================
+ Hits          14100    14106    +6     
- Misses        19584    19591    +7     
  Partials        289      289           
Flag Coverage Δ
android 17.61% <42.10%> (+0.01%) ⬆️
native 9.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...in/kotlin/radio/ks3ckc/ft8af/ui/map/MapViewport.kt 100.00% <100.00%> (ø)
...main/kotlin/radio/ks3ckc/ft8af/ui/map/MapScreen.kt 7.79% <38.88%> (+0.32%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@patrickrb
patrickrb merged commit f1254c8 into dev Sep 26, 2026
18 checks passed
@patrickrb
patrickrb deleted the feat/map-us-states branch September 26, 2026 16:21
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