Skip to content

feat(coords): TWD97 (Taiwan) grid + Go to Coordinate entry#52

Open
jfuginay wants to merge 1 commit into
mainfrom
feat/twd97-taiwan-grid
Open

feat(coords): TWD97 (Taiwan) grid + Go to Coordinate entry#52
jfuginay wants to merge 1 commit into
mainfrom
feat/twd97-taiwan-grid

Conversation

@jfuginay

@jfuginay jfuginay commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Why

A Taiwanese contributor (who did the zh-Hant localization) asked for TWD97 / TM2 (Taiwan) grid support and specifically wants to compare two digit-entry modes — 7+7 vs 5+5. OmniTAK previously had no way to type a coordinate at all (display-only / tap-to-place), so this also adds a general "Go to Coordinate" entry point.

What

  • TWD97Converter — TWD97 / TM2 zone 121 (EPSG:3826). Transverse Mercator on GRS80 (lon0=121°, k0=0.9999, FE=250000, FN=0). TWD97 is GRS80/ITRF-referenced (towgs84=0) so no datum shift is needed. Redfearn forward/inverse.
  • Two digit-input modes
    • full7 — 7+7 absolute metres (the Taiwan 二度分帶 standard; unambiguous).
    • grid5 — 5+5 truncated local grid (MGRS-style; shorter, but parsing recovers the 100 km cell from the current map centre).
  • "Go to Coordinate" sheet (TWD97 / MGRS / Lat-Lon) with the 7+7 ⟷ 5+5 toggle, a live lat/lon + 7+7/5+5 readback preview, and a drop-marker toggle. Reachable from the Tools launcher (Navigation section).
  • Display + Settings.twd97 added to the coordinate-format enums and the Settings format picker (full 7+7 readout).
  • Map jump — new .goToCoordinate notification centres both the 2D (MapLibre) and 3D (Cesium) engines and optionally drops a marker. Handled on a sibling EmptyView (via .background) to keep MapViewController.body under the Swift type-checker ceiling.
  • i18n — en + zh-Hant strings for all new UI.

Verification

  • Converter checked against the yychen/twd97 reference: forward off by 0.004 m, inverse by ~2e-8°, central-meridian easting = 250000 exact, Taiwan round-trips < 1 mm.
  • xcodebuild (Debug, iOS Simulator) BUILD SUCCEEDED.
  • UI rendered (7+7 and 5+5 modes) — Taipei 101 0306966 / 276965925.033971, 121.564504.

🤖 Generated with Claude Code

Add TWD97 / TM2 zone 121 (EPSG:3826) coordinate support so Taiwan
users can read and enter local grid coordinates.

- TWD97Converter: Transverse Mercator on GRS80 (lon0=121, k0=0.9999,
  FE=250000, FN=0). TWD97 is GRS80/ITRF-referenced (towgs84=0) so no
  datum shift is needed. Redfearn forward/inverse, verified to 0.004 m
  against the yychen/twd97 reference; central-meridian E=250000 exact.
- Two digit-input modes: full7 (7+7 absolute, the Taiwan 二度分帶
  standard) and grid5 (5+5 truncated local grid, MGRS-style; parsing
  recovers the 100 km cell from the current map centre).
- New "Go to Coordinate" sheet (TWD97 / MGRS / Lat-Lon) with the
  7+7 vs 5+5 toggle, live lat/lon + 7+7/5+5 readback, and a
  drop-marker toggle. OmniTAK had no manual coordinate entry before.
- Wire .twd97 into the display-format enums + Settings picker; jump
  the map (both engines) via a new .goToCoordinate notification,
  handled on a sibling view to stay under the type-checker ceiling.
- en + zh-Hant localization for all new strings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.

1 participant