Table of Contents

EncDotNet.S57

EncDotNet.S57 reads and writes IHO S-57 Edition 3.1 Electronic Navigational Chart (ENC) cells. It gives you the dataset metadata, feature and vector records, and attributes as encoded, and a typed chart model of point, line and area features with indexed nodes, edges and faces. It also applies update cells (.001, .002, ...), reads and verifies exchange sets, and writes base cells and CATALOG.031 files. It identifies NATO Additional Military Layers (AML) cells and looks up their object classes and attributes in the AML object catalogues. Reference it to work with S-57 data in .NET 10 or later. It depends on EncDotNet.Iso8211, which it installs for you.

Install

dotnet add package EncDotNet.S57

Example: read a cell and list its depth areas

using EncDotNet.S57;

S57Document document = S57DocumentReader.ReadFromFile("path/to/cell.000");

Console.WriteLine($"{document.DataSetIdentification?.DataSetName} at 1:{document.DataSetParameters?.CompilationScale}");

foreach (S57FeatureRecord feature in document.GetFeaturesByObjectCode(S57ObjectCode.DEPARE))
{
    Console.WriteLine($"{feature.RecordName}: {feature.Attributes.Count} attributes, {feature.SpatialPointers.Count} spatial pointers");
}

Main entry points

Records as encoded

Type Use it to
S57DocumentReader Read a cell from a file, stream or bytes into an S57Document
S57DocumentWriter Write an S57Document as a base cell (.000) to a file, stream or bytes
S57Document Get metadata (DSID, DSPM), feature records and vector records; apply an update cell with ApplyChanges
S57FeatureRecord Get a feature's object class, primitive, attributes and pointers
S57VectorRecord Get a node's or edge's coordinates, soundings and topology pointers
S57ObjectCode Identify object classes (DEPARE, SOUNDG, LIGHTS, ...) by their S-57 code

Typed chart model (EncDotNet.S57.Charts)

Type Use it to
S57Chart Get features grouped by primitive and object class, and nodes, edges and faces indexed by record name
S57PointFeature, S57LineFeature, S57AreaFeature, S57MetaFeature Work with a feature and its geometry references
S57IsolatedNode, S57ConnectedNode, S57Edge, S57Face Work with spatial records

Exchange sets (EncDotNet.S57.ExchangeSets)

Type Use it to
S57ExchangeSetReader Find the catalog, base cell and update cells of a single-cell exchange set
S57ExchangeSet Read the cell with its updates applied; verify the exchange set
S57CatalogReader Read CATALOG.031 entries and their coverage
S57CatalogWriter Write CATALOG.031, and compute the CRCs its entries list
S57ExchangeSetVerifier Check each file's CRC-32 against the catalog

NATO Additional Military Layers (EncDotNet.S57.Aml)

Type Use it to
AmlDataSet Get an AML cell's product, metadata and catalogue, and look up its features' object classes and attributes
AmlDataSetMetadata Parse the title, protective marking and other metadata in an AML cell's DSID comment
S57ObjectCatalogue Look up IHO, Inland ENC and AML object classes and attributes by code or acronym

Reading S-57 charts covers each of these with examples, Reading AML data sets covers AML cells, and Writing S-57 charts covers the writers.

Exchange set verification outcomes

S57ExchangeSet.VerifyAsync reports a checksum outcome and a signature outcome for each file, as S57VerificationOutcome values. It doesn't throw for files that fail. S-63 signature verification isn't implemented yet; IS63SignatureVerifier and S63TrustAnchorOptions are the extension point, and files report NotSigned until it is.

S57VerificationOutcome Meaning
Ok The check passed
NoChecksum The catalog entry has no CRC to check against
ChecksumMismatch The file's CRC doesn't match the catalog
FileMissing The file isn't on disk
NotSigned The file has no digital signature
SignatureInvalid, CertificateUntrusted, CertificateExpired, CertificateNotFound S-63 signature outcomes
Error An unexpected error occurred during verification

License

MIT. See LICENSE.