feat(parser): add PocketTopo .top (v3) support#1
Merged
Conversation
Parses PocketTopo's native binary format and converts its RAW shot measurements into the normalized CaveModel: applies per-trip magnetic declination, averages consecutive repeated shots (DistoX triple-shot practice), turns undefined-target shots into splays with anonymous endpoints, and propagates station coordinates breadth-first from reference points (or the origin). Loops are not adjusted. Byte layout cross-checked against TopoDroid's ptopo package, a port of Beat Heeb's reference implementation (incl. his 2026 station-id corrections). Round-trip tested via a from-spec encoder covering declination, averaging, splays, references, trip dates, plain-number vs major.minor ids, truncation, and version/magic rejection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deploying caveviewer with
|
| Latest commit: |
5623486
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://60a6a379.caveviewer.pages.dev |
| Branch Preview URL: | https://feat-pockettopo-top-support.caveviewer.pages.dev |
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.
Background
.topfiles couldn't be opened in the viewer — only processed formats (Survex.3d, Compass.plt, Therion.lox) were supported..topstores raw shot measurements (distance / azimuth / inclination), so support means the parser must also compute station coordinates, not just decode bytes.What Has Changed
src/parser/pocketTopoTop.tsfor the binary.topv3 layout, cross-checked against TopoDroid'sptopopackage (a port of Beat Heeb's reference implementation, incl. his 2026 station-id corrections). Decodes trips (date as .NET ticks, declination), shots (1/65536-circle angles, mm distances,major.minor/ plain-number / undefined station ids), and reference points; the trailing sketch drawings carry no geometry and are skipped.fixed) or the origin. Loops are intentionally not adjusted — misclosure stays visible.parseCaveFiledispatches.top; file-input accept list, drop overlay, and HUD hint mention the new format; README updated (status, formats table, parser notes, testing section).test/helpers/encodeTop.ts) plus 17 round-trip tests covering trig-verified geometry, declination, averaging, splays, references, trip dates, station-id variants, comment/flag record alignment, disconnected components, truncation, and magic/version rejection.Real-world validation
Two genuine PocketTopo files from a public survey-data repo were parsed and cross-checked against Therion's processed
.3dof the same caves (independent oracle):.3d/ published maps1.top)The plan-view render also visually matches the cave's published map. (Fixtures not vendored — the source repo's data licence is ambiguous.)
Screenshots/Video
Checklist
🤖 Generated with Claude Code