Table of Contents

Class S57Dataset

Namespace
EncDotNet.S100.Datasets.S57
Assembly
EncDotNet.S100.Datasets.S57.dll

Thin wrapper over S57Document from the upstream EncDotNet.S57 package. Provides the IsS57File(string) discriminator used by DatasetPipelineFactory to disambiguate .000 files between S-57 and S-101 (which share the extension and ISO 8211 envelope).

public sealed class S57Dataset
Inheritance
S57Dataset
Inherited Members

Properties

DatasetName

Dataset name from the DSID record.

public string DatasetName { get; }

Property Value

string

DeclaredProductSpecification

The S-57 product specification the dataset declares in its DSID PRSP subfield (see S57ProductSpecification), or 0 when it declares none.

public int DeclaredProductSpecification { get; }

Property Value

int

Document

The underlying parsed S-57 document (from the package).

public S57Document Document { get; }

Property Value

S57Document

FeatureCount

Number of feature records in the dataset.

public int FeatureCount { get; }

Property Value

int

TranslationTarget

The S-100 product this dataset should be translated into: S401 for a cell declaring InlandElectronicNavigationalChart, otherwise S101.

public S57TranslationTarget TranslationTarget { get; }

Property Value

S57TranslationTarget

UpdateReport

What happened to the updates when the cell was opened with Open(Stream, IReadOnlyList<Stream>); otherwise null.

public S57UpdateReport? UpdateReport { get; }

Property Value

S57UpdateReport

Methods

DeclaredProductSpecificationOf(S57Document)

The S-57 product specification document declares in its DSID PRSP subfield, or 0 when it has no DSID.

public static int DeclaredProductSpecificationOf(S57Document document)

Parameters

document S57Document

The parsed S-57 document.

Returns

int

IsS57File(string)

Returns true when the file at path appears to be an S-57 dataset (heuristic: the ISO 8211 DDR contains a DSPM field, which is unique to S-57 and not present in S-101). Returns false for non-ISO 8211 files or files lacking DSPM.

public static bool IsS57File(string path)

Parameters

path string

Returns

bool

Open(Stream)

Opens an S-57 base cell from a stream.

public static S57Dataset Open(Stream stream)

Parameters

stream Stream

Returns

S57Dataset

Open(Stream, IReadOnlyList<Stream>)

Opens an S-57 base cell from baseStream and applies the sequential update datasets in updateStreams with S57UpdateApplicator.

public static S57Dataset Open(Stream baseStream, IReadOnlyList<Stream> updateStreams)

Parameters

baseStream Stream

The base cell (.000) stream.

updateStreams IReadOnlyList<Stream>

The update streams, in ascending update-number order.

Returns

S57Dataset

Remarks

Updates are applied while they're for the cell's edition and follow on from each other; the first that doesn't stops the sequence, and an update with edition 0 cancels the cell. What happened is in UpdateReport, and never stops the cell from opening.

Open(string)

Opens an S-57 base cell from a file path.

public static S57Dataset Open(string path)

Parameters

path string

Returns

S57Dataset

ReadMetadata()

Produces the lightweight DatasetMetadata for this already parsed dataset: the canonical S-57 specification, the geographic extent, and the whole-cell display window (issue #460).

public DatasetMetadata ReadMetadata()

Returns

DatasetMetadata

The cell's lightweight metadata.

Remarks

The phased win over a full load is that the S-57 → S-101 translation and the portrayal catalogue are never touched: the extent is folded directly from the raw spatial records' coordinates (2-D vertices and sounding nodes), divided by the coordinate multiplication factor (COMF) from the DSPM field to yield WGS-84 decimal degrees. This mirrors the extent the full render ultimately fits, but skips S-101 feature/attribute materialisation (the display window reads only the raw SCAMIN attribute values).

The display-scale window carries only a coarsest bound, from ResolveCellMinimumDisplayScale(S57Document) (the larger of the compilation scale and the largest feature SCAMIN) — the same value the full processor applies as the whole-cell minimum display scale. The canonical spec name is S-57 with a default edition, matching S57DatasetProcessor.Spec.

ReadMetadata(S57Document)

Produces the lightweight DatasetMetadata for an already-parsed (and, where applicable, update-folded) S57Document. Exposed so the render pipeline's S57DatasetProcessor can surface the same metadata from the merged document it already holds, without re-opening the cell.

public static DatasetMetadata ReadMetadata(S57Document document)

Parameters

document S57Document

The parsed S-57 document.

Returns

DatasetMetadata

The document's lightweight metadata.

Exceptions

ArgumentNullException

document is null.

ReadMetadata(Stream)

Reads only the lightweight DatasetMetadata for an S-57 base cell from stream. See ReadMetadata() for the phased-loading rationale.

public static DatasetMetadata ReadMetadata(Stream stream)

Parameters

stream Stream

The S-57 base cell (.000) stream.

Returns

DatasetMetadata

The cell's lightweight metadata.

ReadMetadata(string)

Reads only the lightweight DatasetMetadata for an S-57 base cell at path — its (canonical) specification, geographic extent, and intended display-scale window — for phased / deferred loading (issue #460). See ReadMetadata() for the rationale and the cheap-scan strategy.

public static DatasetMetadata ReadMetadata(string path)

Parameters

path string

Absolute path to the S-57 base cell (.000).

Returns

DatasetMetadata

The cell's lightweight metadata.

ResolveCellMinimumDisplayScale(S57Document)

Resolves an S-57 cell's whole-cell zoom-out window: the coarsest (largest-denominator) scale at which any of its content is intended to be displayed. This is the larger of the compilation scale (CSCL, DSPM field, S-57 Appendix B.1 §7.3.1.1) and the largest feature SCAMIN (S-57 Appendix A attribute 133) in the cell.

public static int? ResolveCellMinimumDisplayScale(S57Document document)

Parameters

document S57Document

The parsed (and, where applicable, update-folded) S-57 document.

Returns

int?

The window denominator, or null when the cell declares neither a positive compilation scale nor any positive SCAMIN.

Remarks

S-57 carries no minimum display scale. The compilation scale is the largest intended viewing scale — S-52 §3.1.7 uses it only for the overscale indication — and S-65 Annex B §2.1.6 maps it to the S-101 optimum display scale while leaving minimumDisplayScale null. Capping the cell at CSCL therefore hid content the producer encoded to remain visible further out: NOAA SCAMIN values run to 3–5× CSCL, and USACE inland cells (CSCL 1:5,000) to 1:300,000. The largest SCAMIN is the producer's own coarsest visibility statement, so beyond it no feature would draw anyway; features without SCAMIN (area fills, coverage) stay visible up to it.

The compilation scale remains the cell's ranking scale against overlapping cells; see ResolveCompilationScale(S57Document).

Exceptions

ArgumentNullException

document is null.

ResolveCompilationScale(S57Document)

Resolves an S-57 cell's compilation scale (CSCL, DSPM field, S-57 Appendix B.1 §7.3.1.1) — the analogue of the S-101 optimum display scale (S-65 Annex B §2.1.6) used to rank overlapping cells (a smaller denominator is the finer cell).

public static int? ResolveCompilationScale(S57Document document)

Parameters

document S57Document

The parsed S-57 document.

Returns

int?

The positive compilation scale denominator, or null.

Exceptions

ArgumentNullException

document is null.

TranslationTargetFor(S57Document)

The S-100 product document should be translated into, chosen from the S-57 product specification it declares (see TranslationTarget).

public static S57TranslationTarget TranslationTargetFor(S57Document document)

Parameters

document S57Document

The parsed S-57 document.

Returns

S57TranslationTarget