s57: decode the pick report in the engine - #45
Merged
Conversation
catalog.zig holds the S-57 edition 3.1 attribute catalogue as data: 186 attribute labels and 102 enum tables with 1112 values. The source is Appendix A, Chapter 2 (November 2000). A code that the source does not confirm is omitted. An omitted code passes through the report unchanged. decode.zig reads the catalogue and adds the print rules the catalogue does not contain: chart abbreviations for light characteristics (LITCHR 4 prints as Q), units for plain numbers, signal sequences, SCAMIN as '1:30,000 and larger', SORIND as 'Chart 12283 (US)', and S-57 dates. A '--MMDD' date prints as a yearly date. Unknown values stay unchanged.
The tool 'tile57 fcattrs' reads the vendored S-101 Feature Catalogue XML
and writes catalog_s101.zig: 221 attribute labels and 1022 listed
values, keyed by S-101 attribute code. The decode reads S-57 acronyms
from the S-57 catalogue and S-101 codes from this file.
The two catalogues stay separate. S-101 changed attributes that it took
from S-57: CATTRK became the boolean basedOnFixedMarks, BUISHP keeps
five shapes, CATCOA drops its shore types. 104 S-57 codes are absent or
different in the Feature Catalogue. A decode of an S-57 code through the
S-101 tables would give a wrong value.
Regenerate with:
tile57 fcattrs <S-101_FC_1.1.0_20230202.xml>
tile57_s57_report turns one queried feature into the report JSON that a shell renders. The input is the class, the cell name, and the attribute JSON from the query callback. The output contains: a title with the object's key fact (a light's characteristic, a depth area's range, a wreck's least depth), a subtitle, a chip name, notes from INFORM, the rows decoded and sorted into reading order, a one-line provenance footnote, and an 'empty' field when there is nothing to read. fcattrs now also collects the Feature Catalogue's feature types. Class names did not change in S-101, so the S-57 alias maps safely: HULKES reads as Hulk. The meta and collection classes that S-101 does not contain are in a small table in decode.zig.
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.
This branch moves the pick-report decode into the engine so every shell prints the same report.
Unknown values stay unchanged at every step. Regenerate the S-101 tables with "tile57 fcattrs <FeatureCatalogue.xml>".