Repository navigation
Description
EncDotNet.S57 reads NATO Additional Military Layers (AML) cells today, but only as bare numbers. AML is the S-57-encoded family of military overlay products defined in STANAG 7170 and distributed by UKHO. It uses the same ISO 8211 records as ENC, with its own object and attribute catalogues. This issue adds an object model so AML cells can be identified, named and inspected. Portrayal is out of scope: the AML portrayal specification is an S-52 .dai file released only to holders of the S-52 Presentation Library.
What we know
All public sources are on the Admiralty AML page: product specifications, the AML Implementation Guidance Document (Edition 1, 2018), the Handbook, the catalogues and test data.
A scan of the public test data with EncDotNet.S57 0.8.1 found:
-
All 76 unique cells parse without errors. They are the UKHO AML 1.0 base, update and representative sets, and the Bundeswehr AML 3.0 trials data.
-
Detection from the dataset header:
DSID PRSPPREDPROFAML 1.0/2.1 51 MFF, 52 RAL, 53 LBO, 54 CLB, 55 ESB, 56 SBO 1.0 or 2.1 Per product, base and update (e.g. CLB 4/5, ESB 6/7, LBO 10/11, MFF 12/13, RAL 16/17, SBO 18/19) AML 3.0 57 (not listed in the 2018 guidance document) 3.0 20 FRIDGRUPis always 255. -
Codes. AML-specific object and attribute codes start at 20484 and use lowercase acronyms. AML 3.0 adds codes 40101 and up. Codes used in the data are fully covered by the matching catalogue, apart from two standard IHO codes (
C_ASSOand attribute 189) used in 1.0 cells:Catalogue Object classes Attributes O&A Catalogue v1.1.6 (AML 1.0) 171 385 O&A Catalogue v2.x (AML 2.1) 174 387 Feature and Attribute Catalogue v3.0.1 (AML 3.0) 258 473 (plus enumerations and feature–attribute bindings) -
DSIDCOMTis structured. It carriestitle=…; IDO Status = …; Protective Marking = …; Owner Authority = …. The guidance says systems should display the protective marking prominently. In the 1.0 sample cells the degree sign intitledecodes as U+FFFD, so the text encoding of this field needs checking. -
Geometry. One RAL cell uses
ARCC/AR2Darcs. They parse, butS57VectorRecorddoesn't expose them, so arc edges lose their curve. CLB usesSG3D, which is already supported.
Scope
- Object catalogue abstraction. A lookup from object and attribute codes to acronym, name, attribute type and enumerated values. Ship tables for standard IHO S-57, IENC extensions (17000+), and AML 1.0, 2.1 and 3.0. Generate the AML tables from the public catalogues as our own code tables. Don't redistribute the spreadsheets or their definition text: they are UKHO/NATO documents with no stated licence.
- AML detection. Identify a cell's AML product and version from
PRSP/PRED/PROF, and choose the matching catalogue. - AML header metadata. Parse
COMTinto title, IDO status, protective marking, owner authority and caveat. Fix the decoding if it is wrong. - Arc geometry. Expose
ARCC/AR2Don vector records, ideally with a densified polyline helper.
Rendering is out of scope here. So is AML+ / S-501, the S-100 successor, which is still a draft.
Done when
- Every code in the public AML test data resolves to a named class or attribute in the right catalogue version.
- Tests use small synthetic cells built with the ISO 8211 writer. The UKHO and Bundeswehr test data stays local and is not committed.
- A RAL arc edge round-trips with its arc parameters.
Downstream: EncDotNet.S100 will route AML cells away from the S-57 → S-101 translation and report them as AML.
Activity
philliphoff commentedon Nov 2, 2026
Downstream: philliphoff/EncDotNet.S100#1236 (recognise AML cells instead of translating them to S-101).
philliphoff commentedon Nov 3, 2026
Implementation plan
Direction: AML data sets stay
S57DocumentsAn AML cell should be read as a plain
S57DocumentandS57Chart. Don't make a separate document type, and don't add a shared base type. Put an AML layer on top that looks up the product and its catalogue and wraps the document, rather than inheriting from it.ApplyChanges,S57Charttopology, the exchange-set and CATALOG.031 code, and S-63 checks only deal with records and fields. All 76 test cells already parse unchanged. Only two places assume the ENC catalogue:S57ObjectCodeis an enum named for IHO codes. AML codes such as 20484 still fit in it as numbers; they just have no name.S57Chart.CoverageAreasusesM_COVR. That's a standard IHO meta class, so it still applies to AML.PRSP= 10) come throughS57Documenttoday. AML is the same kind of case: same encoding, different catalogue.DSIDinside the file, so separate types would mean the reader returning a union, or callers checking the file before choosing a reader.S57DocumentandS57Chartare sealed records with public constructors. An abstract base, or generics over a catalogue type, would change the public API. The real differences are what the codes mean and what the header says, so they belong in a separate layer.Naming: type names use
DataSet, following S-57 and the existingS57DataSetIdentificationandS57DataSetParameters. Prose keeps saying "cell".1. Catalogue abstraction (core, works for any S-57 product)
S57ObjectCatalogue. It looks up an object class by code or acronym (acronym, name, primitives) and an attribute by code or acronym (acronym, name, typeE/L/F/I/A/S, enumerated values).scripts/. It reads the UKHO spreadsheets from a local path and writes C# code tables with codes, acronyms, types and enumerations only, no definition text. The spreadsheets are never committed.C_ASSOand attribute 189 in the 1.0 cells.S57ObjectCatalogue.For(S57DataSetIdentification)to choose the table fromPRSP/PRED, falling back to IHO.S57ObjectCodeas it is, with no AML members. Catalogues are versioned, and an enum can't give the same code a different meaning in a different version.2. Product detection
S57ProductIdentitywithKind(Enc, InlandEnc, Aml, Unknown), the AML product (MFF, RAL, LBO, CLB, ESB, SBO, and 57 for the integrated 3.0 product),Version, and base or update fromPROF. Use the mappings in the table above.S57DataSetIdentification.Product. This is the only thing EncDotNet.S100 needs.3. AML header metadata
DSIDCOMTis decoded. It's currently read through the generic string path, so the degree sign becomes U+FFFD. Decode it as Latin-1, the wayATTFtext at lexical level 1 already is. Do the same forDSPMandFFPTCOMT, and make the writer encode it the same way.AmlDataSetMetadata.TryParse(string comment). It splits on;and=, matches keys case-insensitively, and keeps unknown keys in a dictionary. It returns title, IDO status, protective marking, owner authority and caveat.4.
AmlDataSetview (by composition)AmlDataSet, built from anS57ChartorS57Document. It exposes the product identity, the metadata, the chosen catalogue, and helpers that resolve a feature's object class and attributes. Building one from a non-AML data set throws;TryCreatereturns false instead.EncDotNet.S57.Amlnamespace in the existing package. It could become a separateEncDotNet.Amlpackage, likeEncDotNet.Noaa, if the core package should stay IHO-only. Product detection stays in core either way.5. Arc geometry
ARCCandAR2D(andELLP/EL2Dif wanted) intoS57VectorRecord. Write them back out inS57DocumentWriter, add their fields to the DDR builder, and check thatApplyChangeskeeps them.S57Edgeand the line and area geometry builders use it, so arc edges keep their curve.6. Tests and docs
PRSP/PRED/PROFcombinationCOMTwith Latin-1 bytesdocs/architecture.mdto say the document model is shared and the catalogue depends on the product.Order
COMTdecoding and expose arcs. These are independent fixes.AmlDataSetand the metadata parsing.Each step is a reasonable PR on its own. Steps 2 and 4 add public API, so the package validation baseline will need to accept the new types.
Open question: does AML 3.0 reuse any 1.0 or 2.1 code with a different meaning? If not, a single combined AML table plus version flags would be simpler than three tables.
Generated by Claude Code
Read and write COMT as Latin-1 and parse AML DSID metadata (#43)
Add S-57 product detection from DSID (#44)
Add S57ObjectCatalogue with IHO and Inland ENC tables (#45)
Read, write and densify S-57 arc/curve edge geometry (#46)
Add the AML 1.0, 2.1 and 3.0 object catalogues (#48)
Add the AmlDataSet view over AML cells (#50)
Skip exchange set catalogues and plain comments in the AML corpus test (
philliphoff commentedon Nov 3, 2026
Done, and released in v0.10.0.
Done-when check. The local-only test
AmlDataSetCorpusTestspasses on all 82 unique cells of the public AML sample and test data (#54). These are the 76 cells described above plus the 6 cells of the AML 2.1 base exchange set, with 281,045 feature records and 835,069 attribute values. For every cell:S57ChartThe update cells also build on their own.
What landed:
COMTis read and written as Latin-1, so the degree sign no longer decodes as U+FFFD.AmlDataSetMetadataparses title, IDO status, protective marking, owner authority and caveat.S57DataSetIdentification.Product(S57ProductIdentity) detects ENC, Inland ENC and AML fromPRSP/PRED/PROF.S57ObjectCataloguewith IHO and Inland ENC tables.For(...)andGetObjectCatalogue()choose a catalogue by product.ARCC/AR2D/EL2D/CT2Darcs are read, written and kept through updates.S57ArcDensifierturns them into polylines, so arc edges keep their curve.scripts/GenerateAmlCatalogues.csfrom the UKHO spreadsheets. The tables hold codes, acronyms, names, types and values, but no definition text. No code changes meaning in a way that could share one table, so there are three tables.AmlDataSetview, the local real-data test anddocs/reading-aml-data-sets.md.CATALOG.031, and it only parses aCOMTwritten askey=valuepairs.Next, downstream: philliphoff/EncDotNet.S100#1236 can now detect AML cells with
document.DataSetIdentification?.Product.Kind == S57ProductKind.Amland report them as AML instead of translating them to S-101.Generated by Claude Code