Table of Contents

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. Open takes 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 is null when no feature has geometry.
  • S124Feature: a feature with its type code, geometry, simple attributes, complex attributes and xlink:href references (GmlReference). S124ComplexAttribute holds a complex attribute's sub-attributes. Edition 2.0.0 nests complex attributes: SubAttributes keys their leaves as "information.text", keeping the first of a repeated one, and Groups keeps each nested one, in order, with its own leaves. The geometry kind is the shared S100GeometryType enum from EncDotNet.S100.Core.
  • S124InformationType: an information type without geometry, such as NavwarnPreamble.
  • S124NavigationalWarning: the typed model. See Typed data model.
  • S124NavigationalWarningRules: the validation rule set. See Validate.
  • S124PortrayalCatalogue: an IVectorPortrayalCatalogue that 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 resolves xlink:href references and parses values.
  • S124NavwarnPreamble has a typed MessageSeriesIdentifier (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 adds PublicationTime, CancellationDate (the warning is valid before it), NavwarnTypeGeneral and its label, NavwarnTypeGeneralName.
  • S124NavwarnPart has the restriction code, the warning text, geometry, and the resolved AffectedAreas and TextPlacements. The text is warningInformation/information in Edition 1.0.0 and warningInformation/information/text in 2.0.0, which also gives the warning type (NavwarnType and NavwarnTypeCode, from navwarnTypeDetails). A 2.0.0 part can give the text in several languages, one information each: Information holds every one as an S124WarningText (language code and text), and WarningInformation is the first. ValidityRanges holds one S124DateRange per fixedDateRange: in Edition 2.0.0 each end is a date with an optional UTC time of day.
  • S124AffectedArea and S124TextPlacement are the features reached through the feature catalogue associations areaAffected and TextAssociation.
  • S124WarningReference has the reference category (from the code attribute in Edition 2.0.0) and what it refers to: a MessageReference in Edition 1.0.0, or one Warnings identifier 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 with NoMessageOnHand).
  • S124SpatialQuality has 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