Table of Contents

Class S57S101Mapping

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

Mapping from the S-57 (Edition 3.1) Object Catalogue to the S-101 Feature Catalogue. Encodes feature-class and attribute mappings, plus richer rule types used by the S-57 to S-101 conversion: cross-class redirects, per-feature attribute overrides, and per-value enum remaps.

public sealed class S57S101Mapping
Inheritance
S57S101Mapping
Inherited Members

Remarks

Rule data is sourced primarily from the IHO draft "S-57 to S-101 Conversion Guidance" (S-100WG / S-101 Project Team 6, January 2021), cross-checked against the IHO S-57 Object Catalogue (Appendix A, Edition 3.1) for OBJL/ATTL numeric codes.

The Default mapping is built from compiled-in seed data; no resource files are loaded at runtime. Use the S57S101Mapping.Builder to compose custom mappings.

Properties

AttributeCount

Number of attributes in the mapping.

public int AttributeCount { get; }

Property Value

int

AttributeRules

Attribute rules keyed by S-57 ATTL.

public IReadOnlyDictionary<ushort, S57AttributeRule> AttributeRules { get; }

Property Value

IReadOnlyDictionary<ushort, S57AttributeRule>

Default

The default mapping bundled with this assembly. Suitable for most ENC base cells; extend by composing your own S57S101Mapping.Builder when a producer uses additional object classes.

public static S57S101Mapping Default { get; }

Property Value

S57S101Mapping

FeatureCount

Number of feature classes in the mapping.

public int FeatureCount { get; }

Property Value

int

FeatureRules

Feature-class rules keyed by S-57 OBJL.

public IReadOnlyDictionary<ushort, S57FeatureRule> FeatureRules { get; }

Property Value

IReadOnlyDictionary<ushort, S57FeatureRule>

Methods

BuildAcronymView(IEnumerable<S57AttributeValue>)

Builds a {acronym → value} view of an S-57 feature's raw attributes, suitable for passing to ResolveFeature(ushort, IReadOnlyDictionary<string, string>). Values for attributes whose ATTL is unknown to this mapping are omitted.

public IReadOnlyDictionary<string, string> BuildAcronymView(IEnumerable<S57AttributeValue> attributes)

Parameters

attributes IEnumerable<S57AttributeValue>

Returns

IReadOnlyDictionary<string, string>

ForSpec(string)

The bundled mapping into the Feature Catalogue of targetSpec. For "S-101" this is Default. For another product sharing the S-101 document model it is Default restricted to the feature classes and attributes that product's bundled catalogue defines (see RestrictToFeatureTypes(Func<string, bool>) and RestrictToAttributes(Func<string, bool>)). For S-401 the inland ENC object classes and attributes (IEHG IENC Feature Catalogue 2.4) are added before restricting, so an inland cell's 17000-range codes translate too. The anchorage rules are also replaced for S-401: an anchorage area whose CATACH is 8 (small craft mooring area) becomes MooringArea, and CATACH 10 becomes categoryOfAnchorage 16 (IEHG S-57 ENC to S-401 Conversion Guidance clauses 3.3, 3.4 and 3.85). A gate's VERCLR becomes verticalClearanceOpen (clause 3.55). Built once per spec.

public static S57S101Mapping ForSpec(string targetSpec)

Parameters

targetSpec string

The target product, e.g. "S-401".

Returns

S57S101Mapping

The shared mapping for that product.

Exceptions

InvalidOperationException

No Feature Catalogue is bundled for targetSpec.

ResolveAttribute(string, string, ResolvedFeature)

Resolves an S-57 attribute, in the context of a previously resolved feature, to the S-101 attribute name and value to emit.

public ResolvedAttribute? ResolveAttribute(string s57Acronym, string value, ResolvedFeature feature)

Parameters

s57Acronym string

S-57 attribute acronym (e.g. CATCOA).

value string

Raw S-57 attribute value as a string.

feature ResolvedFeature

The resolved feature whose effective overrides apply to this attribute.

Returns

ResolvedAttribute

A ResolvedAttribute, or null if the attribute is not mapped or a value remap drops it.

ResolveAttribute(ushort, string, ResolvedFeature)

Resolves an S-57 attribute identified by its numeric code, in the context of a previously resolved feature, to the S-101 attribute name and value to emit. Prefer this overload when the ATTL is known: an inland ENC attribute re-registers a standard acronym in lower case under a different code (e.g. catslc = 17012 for CATSLC), so an acronym alone may not identify the rule.

public ResolvedAttribute? ResolveAttribute(ushort attl, string value, ResolvedFeature feature)

Parameters

attl ushort

S-57 numeric attribute code (ATTL).

value string

Raw S-57 attribute value as a string.

feature ResolvedFeature

The resolved feature whose effective overrides apply.

Returns

ResolvedAttribute

A ResolvedAttribute, or null if the attribute is not mapped or a value remap drops it.

ResolveAttributeCode(ushort)

Resolves a numeric S-57 ATTL code to its default S-101 Feature Catalogue attribute name. Returns null when the code is not in the mapping table or has no flat S-101 equivalent.

public string? ResolveAttributeCode(ushort attl)

Parameters

attl ushort

Returns

string

ResolveFeature(ushort, IReadOnlyDictionary<string, string>)

Resolves an S-57 feature instance without considering geometry; equivalent to passing None.

public ResolvedFeature? ResolveFeature(ushort objl, IReadOnlyDictionary<string, string> s57AttributesByAcronym)

Parameters

objl ushort
s57AttributesByAcronym IReadOnlyDictionary<string, string>

Returns

ResolvedFeature

ResolveFeature(ushort, IReadOnlyDictionary<string, string>, S57GeometryPrimitive)

Resolves an S-57 feature instance to the S-101 feature class it should map to, evaluating any conditional redirects defined for the OBJL against the supplied S-57 attribute values.

public ResolvedFeature? ResolveFeature(ushort objl, IReadOnlyDictionary<string, string> s57AttributesByAcronym, S57GeometryPrimitive primitive)

Parameters

objl ushort

S-57 numeric object class (OBJL).

s57AttributesByAcronym IReadOnlyDictionary<string, string>

The feature's S-57 attributes keyed by acronym. Use BuildAcronymView(IEnumerable<S57AttributeValue>) to construct this view from a feature's raw attribute records.

primitive S57GeometryPrimitive

The feature's geometric primitive, used to evaluate geometry-conditional redirects (ConditionPrimitives). Pass None when geometry is irrelevant.

Returns

ResolvedFeature

A ResolvedFeature, or null if the OBJL has no rule or all matching rules drop the feature.

ResolveFeatureCode(ushort)

Resolves a numeric S-57 OBJL code to its default S-101 Feature Catalogue code. Returns null when the code is not in the mapping table or has no default code (because every concrete destination depends on a redirect condition).

public string? ResolveFeatureCode(ushort objl)

Parameters

objl ushort

Returns

string

RestrictToAttributes(Func<string, bool>)

Returns a copy of this mapping whose attribute rules only target attributes for which isDefined holds; a rule whose default attribute is not defined keeps its ATTL but loses the target, so the attribute is reported as rule-dropped. Feature rules, including their attribute overrides, are carried over unchanged.

public S57S101Mapping RestrictToAttributes(Func<string, bool> isDefined)

Parameters

isDefined Func<string, bool>

Whether the target Feature Catalogue defines an attribute code.

Returns

S57S101Mapping

The restricted mapping.

RestrictToFeatureTypes(Func<string, bool>)

Returns a copy of this mapping that only targets feature classes for which isDefined holds. A rule whose default class is not defined keeps its OBJL but loses the default, so instances that no remaining redirect claims are dropped (and reported as rule-dropped, not unmapped); redirects to an undefined class are removed. Attribute rules are carried over unchanged.

public S57S101Mapping RestrictToFeatureTypes(Func<string, bool> isDefined)

Parameters

isDefined Func<string, bool>

Whether the target Feature Catalogue defines a feature class code.

Returns

S57S101Mapping

The restricted mapping.

TryGetAttl(string, out ushort)

Try to look up the numeric ATTL for a given S-57 attribute acronym.

public bool TryGetAttl(string s57Acronym, out ushort attl)

Parameters

s57Acronym string
attl ushort

Returns

bool