fix(adif): export/import coordinates as standard ADIF LAT/LON - #234
Merged
Merged
Conversation
Nextlog round-tripped contact coordinates through non-standard `lat_n`/ `lon_w` fields carrying raw decimal degrees. No other logger (LoTW/TQSL, Cloudlog, N1MM, GridTracker) emits or reads those fields, and decimal degrees aren't valid ADIF for the Location data type — so imported ADIF never populated coordinates and exported coordinates were unreadable elsewhere, silently breaking mapping interop. Emit and parse the spec-correct `LAT`/`LON` fields in `XDDD MM.MMM` form (hemisphere letter + degrees + minutes), converting to/from signed decimal degrees via new pure helpers `adifCoordToDecimal` / `decimalToAdifCoord`. Import still accepts the legacy `lat_n`/`lon_w` decimal fields as a fallback so previously-exported Nextlog files keep round-tripping. An exact 0 (equator/prime meridian) now exports too. Adds pure-function tests for both helpers (all four hemispheres, origin, malformed input, decimal↔ADIF round-trip) and generateAdif coverage for the new LAT/LON output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Nextlog round-tripped contact coordinates through non-standard
lat_n/lon_wfields carrying raw decimal degrees. This is broken interop on two fronts:LAT/LONfields. Importing an ADIF file from any of them leftlatitude/longitudenull, so those contacts never got coordinates (breaking mapping).XDDD MM.MMM(hemisphere letter, 3-digit degrees, decimal minutes), e.g.N040 26.500. Nextlog's exported coordinates were unreadable by external tools even where the field name matched.Solution
Emit and parse the spec-correct
LAT/LONfields, converting to/from signed decimal degrees:adifCoordToDecimal('N040 26.500')→40.44167(S/W hemispheres negative; rejects malformed input and minutes ≥ 60).decimalToAdifCoord(40.44167, 'lat')→'N040 26.500'(zero-padded degrees/minutes, correct hemisphere per axis).<lat:11>N040 26.500/<lon:11>W073 58.000instead of the old decimallat_n/lon_w. An exact0(equator / prime meridian) is now emitted too.lat/lon, and still accepts the legacylat_n/lon_wdecimal fields as a fallback so files previously exported by Nextlog keep round-tripping (backwards compatible).No schema change —
contacts.latitude/longituderemain decimal degrees; only the ADIF wire format changed.Testing
npm run typecheck— cleannpm run lint— cleannpm run build— compiles successfullynpx playwright test tests/adif-generate.spec.ts— 19 passed, including new coverage:adifCoordToDecimal: four hemispheres, origin, case/whitespace tolerance, malformed-input rejectiondecimalToAdifCoord: padded formatting + decimal→ADIF→decimal round-trip within ~1 mgenerateAdif: emits standardLAT/LON, drops the legacy field names, omits coordinates when absentFuture follow-up
insertAdifRecord) is covered indirectly via the pure helpers; a full integration test would need the Playwright DB fixture.LAT/LONprecision isMM.MMM(~1 m), matching ADIF's canonical example — sufficient for grid-derived coordinates.🤖 Generated with Claude Code