Repository navigation
Description
EncDotNet.S100 builds S-57 cells in memory (philliphoff/EncDotNet.S100#1210, the S-101 → S-57 translator) and writes them with S57DocumentWriter from 0.9.0 (philliphoff/EncDotNet.S100#1213). That work found three gaps in the EncDotNet.S57 types. 0.9.0 doesn't close any of them, so EncDotNet.S100 keeps a local workaround for each.
1. No attribute catalogue (ATTL → acronym and type)
There is no S57ObjectCode-style lookup for attributes. A caller can't turn an ATTL into its acronym (116 → OBJNAM), or the reverse, and can't get its type (E/L/F/I/A/S) or whether it is a national attribute (ATTL 300+, NATF).
Why it matters: a writer of S-57 needs to know which attributes are Lists (comma-joined values) and which are Enumerated (one value), and which go in NATF. A reader needs it to show attribute names.
Workaround in EncDotNet.S100: hand-written acronym → ATTL tables (S101ToS57Rules.S57AttributeCodes, plus a KnownAttls table in the round-trip test), and a list-attribute set.
Suggested shape: S57AttributeCode (enum, or a catalogue class) from the S-57 Appendix A Object Catalogue, with the acronym, ATTL, type and national flag.
2. S57ObjectCode stops at 160 (TS_FEB)
The S-57 Edition 3.1 Object Catalogue defines object classes 161–167 (TS_PRH, TS_PNH, TS_PAD, TS_TIS, T_HMON, T_NHMN, T_TIMS). NOAA cells use them: the local corpus has OBJL 163. The cartographic $ classes (500+, for example $CSYMB, $TEXTS) are also missing. The writer already counts that range for DSSI NOCR.
Why it matters: these codes can't be named, so Enum.IsDefined is false and the codes show up as bare numbers.
Workaround in EncDotNet.S100: cast the raw OBJL to S57ObjectCode and fall back to the number when naming it.
3. No helper to build a FOID/LNAM from its parts
S57RecordName.FromLongName(int agencyCode, int featureId, int featureSubdivision)takes FIDN asint. FIDN is ab14(unsigned), so a FIDN aboveint.MaxValueneedsunchecked((int)fidn).S57LongNameholds it asuint. The two types disagree.- There's no conversion between
S57LongNameandS57RecordName, or to and from the packed 8-byteLNAM(AGEN b12, FIDN b14, FIDS b12) thatFFPTholds.
Workaround in EncDotNet.S100: unchecked((int)fidn) when setting S57RecordName.FeatureId, and new S57LongName((ushort)agen, unchecked((uint)fidn), (ushort)fids) for FFPT.
Suggested shape: S57RecordName.FromLongName(S57LongName), an S57LongName property on feature record names that round-trips through uint, and S57LongName.ToLnam()/FromLnam(ReadOnlySpan<byte>).
Smaller, nice to have
- Typed values for the DSID/DSPM codes a new base cell sets:
EXPP,PRSP,PROF,DSTR,HDAT,DUNI/HUNI/PUNI,COUN. They are plaininttoday. - A helper that picks the lowest
AALL/NALLthat encodes a set of strings. EncDotNet.S100 has its own (S101ToS57LexicalLevels).
Activity
Add attribute classes, codes above 160 and LNAM helpers (#49) (#51)
Add typed DSID/DSPM codes and a lexical-level helper (#49) (#52)
philliphoff commentedon Nov 3, 2026
Done in #51 and #52. They aren't in a release yet;
v0.9.0predates them.1. Attribute catalogue.
S57ObjectCatalogue.Ihomaps attribute code ↔ acronym (116↔OBJNAM), withType(S57AttributeType: E/L/F/I/A/S) and enumerated values (#45). #51 addsClass(S57AttributeClass:Feature,National,Spatial,Cartographic) andIsNationalfor attributes that go in NATF.S57Document.GetObjectCatalogue()andS57Chart.GetObjectCatalogue()pick the right catalogue for a data set.2. Object codes above 160 (#51). A correction to the issue:
TS_PRH,TS_PNH,TS_PAD,TS_TIS,T_HMON,T_NHMNandT_TIMSare codes 136–142 in S-57 Appendix A, andS57ObjectCodealready had them. The codes that were actually missing are now members:161
ARCSLN, 162ASLXISand 163NEWOBJ, from the Edition 3.1 supplement. The OBJL 163 in the NOAA corpus isNEWOBJ.The cartographic
$classes, renamed because C# names can't contain$:$AREASCartographicArea$LINESCartographicLine$CSYMBCartographicSymbol$COMPSCartographicCompass$TEXTSCartographicText3. Long names (#51).
S57RecordName.FromLongName(S57LongName)keeps a FIDN aboveint.MaxValueas theintwith the same bits.S57LongName.ToLnam(),TryWriteLnam(Span<byte>)andFromLnam(ReadOnlySpan<byte>)convert to and from the packed 8-byteLNAM: AGEN, FIDN and FIDS, each little-endian.Nice to have (#52).
intproperties:S57ExchangePurpose,S57ProductSpecification,S57ApplicationProfile,S57DataStructure,S57HorizontalDatum,S57VerticalDatum,S57DepthUnits,S57HeightUnits,S57PositionalAccuracyUnitsandS57CoordinateUnits.S57LexicalLevels.Lowest(...)picks the lowest lexical level that encodes a set of strings.CanEncode(...)checks one string.WithLowestLevels(document)setsAALL/NALLfrom a document's values.EncDotNet.S100 can drop each of its workarounds once it moves to the release that includes these:
S57AttributeCodes,KnownAttlsand the list-attribute setS57ObjectCatalogue.IhoS57ObjectCodeuncheckedFIDN castsFromLongName(S57LongName)andToLnam()/FromLnam()S101ToS57LexicalLevelsS57LexicalLevelsGenerated by Claude Code