Class S57S101Mapping
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
AttributeRules
Attribute rules keyed by S-57 ATTL.
public IReadOnlyDictionary<ushort, S57AttributeRule> AttributeRules { get; }
Property Value
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
FeatureCount
Number of feature classes in the mapping.
public int FeatureCount { get; }
Property Value
FeatureRules
Feature-class rules keyed by S-57 OBJL.
public IReadOnlyDictionary<ushort, S57FeatureRule> FeatureRules { get; }
Property Value
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
attributesIEnumerable<S57AttributeValue>
Returns
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
targetSpecstringThe 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
s57AcronymstringS-57 attribute acronym (e.g.
CATCOA).valuestringRaw S-57 attribute value as a string.
featureResolvedFeatureThe resolved feature whose effective overrides apply to this attribute.
Returns
- ResolvedAttribute
A ResolvedAttribute, or
nullif 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
attlushortS-57 numeric attribute code (ATTL).
valuestringRaw S-57 attribute value as a string.
featureResolvedFeatureThe resolved feature whose effective overrides apply.
Returns
- ResolvedAttribute
A ResolvedAttribute, or
nullif 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
attlushort
Returns
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
objlushorts57AttributesByAcronymIReadOnlyDictionary<string, string>
Returns
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
objlushortS-57 numeric object class (OBJL).
s57AttributesByAcronymIReadOnlyDictionary<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.
primitiveS57GeometryPrimitiveThe feature's geometric primitive, used to evaluate geometry-conditional redirects (ConditionPrimitives). Pass None when geometry is irrelevant.
Returns
- ResolvedFeature
A ResolvedFeature, or
nullif 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
objlushort
Returns
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
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
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)