Skip to content

feat: draw maidenhead grid on map #50

Description

@pskillen

Problem

CodeplugMap plots channel markers and zone hulls but gives no Maidenhead grid context. Operators working with locators (#11 display, #47 standalone tool) cannot visually align map position with grid squares.

Intended outcome

Draw a Maidenhead grid overlay on the existing map component (src/components/CodeplugMap/CodeplugMap.tsx), controlled by a user setting.

Grid rendering

  • Overlay field boundaries (4-character / ~2° × 1°) and/or square boundaries (6-character / ~5 km) as map lines.
  • Render as a Leaflet layer (e.g. Polyline grid, L.geoJSON, or canvas/grid plugin) that updates on pan/zoom.
  • Grid lines should be subtle (low-contrast stroke) so channel markers and zone hulls remain primary.
  • Only draw grid lines in the current map viewport (or a sensible buffered bounds) for performance.

Settings

On the Settings page (/settings), add a Maidenhead grid control:

Option Behaviour
Off No grid (default)
4-digit Field grid only
6-digit Field + square grid
  • Persist in browser localStorage (same pattern as tile provider in useMapSettings).
  • CodeplugMap reads the setting via useMapSettings (extend hook + Settings.tsx).

Scope of map instances

Apply to all CodeplugMap embeds (channel detail compact map, zone views, any future full-map use) unless a prop override is needed later.

Affected

  • src/components/CodeplugMap/CodeplugMap.tsx — grid overlay layer
  • New helper, e.g. src/lib/maidenheadGrid.ts — compute line segments for viewport bounds at 4/6-digit precision (reuse rules from src/lib/maidenhead.ts)
  • src/hooks/useMapSettings.ts — new setting + localStorage key
  • src/routes/Settings.tsx — UI control
  • src/components/CodeplugMap/CodeplugMap.md — document overlay behaviour

Notes / dependencies

  • Grid math should stay consistent with coordsToLocator / locatorToCoords in src/lib/maidenhead.ts.
  • No server calls; purely client-side geometry.
  • 8/10-digit subsquare grids are out of scope for this issue.

Out of scope

Workflow note

Branch from origin/main, atomic conventional commits, PR linking Closes #.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions