Skip to content

feat: Add MGRS graticule overlay#93

Merged
ThomasHalwax merged 3 commits intomainfrom
feature/mgrs-graticule
Feb 14, 2026
Merged

feat: Add MGRS graticule overlay#93
ThomasHalwax merged 3 commits intomainfrom
feature/mgrs-graticule

Conversation

@axel-krapotke
Copy link
Contributor

Summary

Adds an MGRS (Military Grid Reference System) graticule overlay to the map, selectable via View → Graticules → MGRS.

Features

  • Grid Zone Designations (GZD) — always visible, with zone+band labels (e.g. 32V)
  • 100 km grid — appears at resolution ≤ 1200 m/px with 100k square letter labels (e.g. KM)
  • 10 km grid — appears at resolution ≤ 120 m/px with digit labels (e.g. 3 · 7)
  • 1 km grid — appears at resolution ≤ 12 m/px with 2-digit labels (e.g. 32 · 74)
  • UTM special zones: Norway (31V/32V) and Svalbard (31X/33X/35X/37X) with per-latitude clipping
  • Graceful fallback for cursor coordinates outside UTM limits (>84°N / <80°S)

Visual

  • Red-toned lines for visibility on light and dark basemaps
  • Graticule renders below feature layers (correct z-ordering)
  • Lines clip smoothly at zone boundaries, no gaps between zones

Technical

  • Single module: src/renderer/components/map/mgrsGraticule.js
  • Uses geodesy/mgrs.js for UTM/MGRS conversions
  • clipToZone() for per-latitude zone clipping at special zone boundaries
  • verticalLineSamples() adds extra interpolation points at band transitions (56°N, 64°N, 72°N)
  • Spec: specs/mgrs-graticule.md

Changes

  • src/renderer/components/map/mgrsGraticule.js — new MGRS graticule layer
  • src/renderer/components/map/graticules.js — layer insertion below features
  • src/renderer/components/map/Map.js — pass vectorLayers to graticule registration
  • src/renderer/model/OSDDriver.js — handle coordinates outside UTM limits

Insert graticule layer above tile layers but below vector layers
so that map symbols are not obscured by grid labels.
Was zIndex: 1000 which put it above everything. Now zIndex: 1,
just above tile layers.
Remove explicit zIndex (which forces layer above all others in OL).
Instead insert graticule before the first vector layer in the layer
stack, so it renders above tiles but below map features.
@ThomasHalwax ThomasHalwax merged commit d815783 into main Feb 14, 2026
1 check passed
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