EncDotNet.S100.Datasets.S124
EncDotNet.S100.Datasets.S124 reads
IHO S-124 Navigational
Warnings datasets: GML files (S-100 Part 10b) that carry NAVAREA, coastal and
local warnings. It parses a dataset into features and information types,
projects it into a typed model, validates it, and loads the S-124 portrayal
catalogue. Reference it when you need typed access to S-124 warnings or their
validation rules. To open and render any product, including S-124, use the
EncDotNet.S100 package, which includes this
one.
Install
dotnet add package EncDotNet.S100.Datasets.S124
Read a dataset
Open the dataset, then project it into the typed model:
using EncDotNet.S100.Datasets.S124;
using EncDotNet.S100.Datasets.S124.DataModel;
var dataset = S124Dataset.Open("path/to/navwarn.gml");
var warning = S124NavigationalWarning.From(dataset, out var diagnostics);
var msi = warning.Preamble?.MessageSeriesIdentifier;
Console.WriteLine($"Warning {msi?.WarningNumber}/{msi?.Year} ({msi?.ProductionAgency})");
Console.WriteLine($" Area: {warning.Preamble?.GeneralArea}");
foreach (var part in warning.Parts)
{
Console.WriteLine($" Part {part.Id}: restriction {part.Restriction}");
Console.WriteLine($" {part.WarningInformation}");
foreach (var area in part.AffectedAreas)
Console.WriteLine($" affected area {area.Id} ({area.GeometryKind})");
}
foreach (var diagnostic in diagnostics)
Console.WriteLine(diagnostic);
Main types
S124Dataset: the parsed dataset, with its features, information types and dataset identification.Opentakes a path or a stream.ReadMetadata(static, for a path or stream, or on an open dataset) returns the declared product specification and the WGS 84 extent of the feature geometry without running portrayal. The extent isnullwhen no feature has geometry.S124Feature: a feature with its type code, geometry, simple attributes, complex attributes andxlink:hrefreferences (GmlReference).S124ComplexAttributeholds a complex attribute's sub-attributes. Edition 2.0.0 nests complex attributes:SubAttributeskeys their leaves as"information.text", keeping the first of a repeated one, andGroupskeeps each nested one, in order, with its own leaves. The geometry kind is the sharedS100GeometryTypeenum fromEncDotNet.S100.Core.S124InformationType: an information type without geometry, such asNavwarnPreamble.S124NavigationalWarning: the typed model. See Typed data model.S124NavigationalWarningRules: the validation rule set. See Validate.S124PortrayalCatalogue: anIVectorPortrayalCataloguethat loads the catalogue's XSLT rules, symbols, line styles, area fills and colour palettes.
The reader extracts the features NavwarnPart, NavwarnAreaAffected and
TextPlacement.
Typed data model
S124Dataset is a feature bag: attributes are strings keyed by code, and
references are unresolved. The EncDotNet.S100.Datasets.S124.DataModel
namespace projects it into typed objects:
S124NavigationalWarning.From(dataset, out diagnostics)builds the typed graph, rooted at the warning. It resolvesxlink:hrefreferences and parses values.S124NavwarnPreamblehas a typedMessageSeriesIdentifier(warning number, year, production agency, country and, in Edition 2.0.0, warning type and interoperability identifier), the general area, locality, title, NAVAREA and NAVTEX values, and promulgating authority. Edition 2.0.0 addsPublicationTime,CancellationDate(the warning is valid before it),NavwarnTypeGeneraland its label,NavwarnTypeGeneralName.S124NavwarnParthas the restriction code, the warning text, geometry, and the resolvedAffectedAreasandTextPlacements. The text iswarningInformation/informationin Edition 1.0.0 andwarningInformation/information/textin 2.0.0, which also gives the warning type (NavwarnTypeandNavwarnTypeCode, fromnavwarnTypeDetails). A 2.0.0 part can give the text in several languages, oneinformationeach:Informationholds every one as anS124WarningText(language code and text), andWarningInformationis the first.ValidityRangesholds oneS124DateRangeperfixedDateRange: in Edition 2.0.0 each end is a date with an optional UTC time of day.S124AffectedAreaandS124TextPlacementare the features reached through the feature catalogue associationsareaAffectedandTextAssociation.S124WarningReferencehas the reference category (from thecodeattribute in Edition 2.0.0) and what it refers to: aMessageReferencein Edition 1.0.0, or oneWarningsidentifier per referenced warning in 2.0.0, such as the warnings a cancellation cancels (category 1) or an in-force bulletin lists (category 3, or none withNoMessageOnHand).S124SpatialQualityhas the quality-of-position code.
The reader keeps the leaves of a nested complex attribute under dotted keys
(information.text, information.language), the first of a repeated one
winning, and a code list or enumeration value's code as <name>.code.
Each object keeps attributes the model doesn't read in its ExtraAttributes
dictionary, so extension and later-edition attributes aren't lost. Unresolved
xlinks, values that don't parse and duplicate preambles become
ProjectionDiagnostic entries (from EncDotNet.S100.DataModel) instead of
exceptions. From throws only when the dataset has no features and no
information types.
Validate
S124NavigationalWarningRules, in the
EncDotNet.S100.Datasets.S124.Validation namespace, is the default rule set for
the typed model. It's built on the validation types in the
EncDotNet.S100.Validation namespace. Rule IDs have the form S124-R-{clause}
and trace to the S-124 Edition 1.0.0 or 2.0.0 Feature Catalogue, or to S-100
Part 10b for shared encoding rules. S124-R-3.1 checks the Edition 1.0.0
NAVAREA attribute, which Edition 2.0.0 drops, so it only fires on datasets
that carry it. S124-R-2.2 accepts a messageSeriesIdentifier year of
two digits (26, as AMSA writes it) or four (2026). The EncDotNet.S100 package's dataset.Validate() runs
the same rule set.
using EncDotNet.S100.Datasets.S124;
using EncDotNet.S100.Datasets.S124.DataModel;
using EncDotNet.S100.Datasets.S124.Validation;
var dataset = S124Dataset.Open("path/to/navwarn.gml");
var warning = S124NavigationalWarning.From(dataset, out _);
var report = S124NavigationalWarningRules.Validate(warning);
foreach (var finding in report.Findings)
Console.WriteLine($"[{finding.Severity}] {finding.RuleId}: {finding.Message}");
| Rule ID | Severity | Checks |
|---|---|---|
S124-R-1.1 |
Error | The warning contains at least one NavwarnPart. |
S124-R-2.1 |
Error | The warning includes a NavwarnPreamble. |
S124-R-2.2 |
Error | messageSeriesIdentifier has a positive warning number and a plausible year. |
S124-R-3.1 |
Error | NAVAREA is one of the IMO NAVAREA codes (I to XXI). |
S124-R-4.1 |
Error | All coordinates are within the WGS 84 latitude and longitude ranges. |
S124-R-4.2 |
Error | Surface exterior rings are closed and have at least four positions. |
S124-R-5.1 |
Warning | Each NavwarnPart has non-empty warning text. |
S124-R-6.1 |
Error | A References information type that sets referenceCategory identifies the warnings it refers to: messageReference (Edition 1.0.0) or messageSeriesIdentifier (2.0.0). |
The rules check one dataset at a time. Cross-dataset checks, such as resolving
the warning that a cancellation refers to, aren't included. Projection
problems, such as a duplicate preamble, are reported in the diagnostics from
From, not as findings.
Portrayal
The S-124 dataset processor in EncDotNet.S100.Datasets.Pipelines converts an
S124Dataset to S-100 Part 9 FeatureXML with the shared
GmlFeatureXmlSource<TFeature> from EncDotNet.S100.Core, then runs the
bundled S-124 portrayal catalogue's XSLT rules over it. There's no
S-124-specific FeatureXML source type.
See also
- Loading datasets: open files, folders, ZIPs
and exchange sets through the
EncDotNet.S100package. - Reading product data: features, information types and typed models for each product.
- Typed data models: the typed root for each product and the shared diagnostic codes.
- Custom catalogues and validation: run the bundled rules and add your own.