Table of Contents

Class GmlCoordinateParser

Namespace
EncDotNet.S100.Features
Assembly
EncDotNet.S100.Core.dll

Shared GML coordinate parsing utilities for S-100 Part 10b encoded datasets.

public static class GmlCoordinateParser
Inheritance
GmlCoordinateParser
Inherited Members

Remarks

Positions are read latitude first, the EPSG:4326 order S-100 Part 10b ยง6.2 requires, unless the caller passes LongitudeFirst. Readers decide the order once per dataset with AssessAxisOrder(XElement), the shared axis-order check (AxisOrderCheck, issue #650), and pass it to every parse, so a dataset is never split between orders. Separator handling tolerates both standard whitespace and comma-separated tokens (a producer-bug compensation seen in some real-world S-122 and S-128 datasets).

Methods

AssessAxisOrder(XElement)

Runs the shared axis-order check (AxisOrderCheck) over every gml:pos and gml:posList under root, anchored on the dataset's gml:boundedBy/gml:Envelope, and returns the order to read the dataset in.

public static (GmlAxisOrder Order, AxisOrderAssessment? Assessment) AssessAxisOrder(XElement root)

Parameters

root XElement

The dataset root element.

Returns

(GmlAxisOrder Order, AxisOrderAssessment Assessment)

LongitudeFirst when the check finds the dataset swapped, otherwise LatitudeFirst; and the assessment (or null when the dataset has no positions), for the reader to attach to its dataset model.

ParseCurveCoordinates(XElement)

Parses curve coordinates from a GML curve property element by extracting gml:posList and gml:pos children.

public static IReadOnlyList<GeoPosition> ParseCurveCoordinates(XElement curveContainer)

Parameters

curveContainer XElement

Returns

IReadOnlyList<GeoPosition>

ParseCurveCoordinates(XElement, GmlAxisOrder)

Parses curve coordinates from a GML curve property element, reading them in the given axisOrder.

public static IReadOnlyList<GeoPosition> ParseCurveCoordinates(XElement curveContainer, GmlAxisOrder axisOrder)

Parameters

curveContainer XElement
axisOrder GmlAxisOrder

Returns

IReadOnlyList<GeoPosition>

ParsePointElement(XElement, XNamespace?)

Extracts a point coordinate from a GML point property element by searching for gml:pos across common nesting patterns.

public static GeoPosition? ParsePointElement(XElement element, XNamespace? s100Ns = null)

Parameters

element XElement
s100Ns XNamespace

Returns

GeoPosition?

ParsePointElement(XElement, XNamespace?, GmlAxisOrder)

Extracts a point coordinate from a GML point property element, reading it in the given axisOrder.

public static GeoPosition? ParsePointElement(XElement element, XNamespace? s100Ns, GmlAxisOrder axisOrder)

Parameters

element XElement
s100Ns XNamespace
axisOrder GmlAxisOrder

Returns

GeoPosition?

ParsePos(string)

Parses a gml:pos value into a single coordinate pair.

public static GeoPosition? ParsePos(string posValue)

Parameters

posValue string

Returns

GeoPosition?

The parsed (latitude, longitude) pair, or null if parsing fails.

ParsePos(string, GmlAxisOrder)

Parses a gml:pos value into a single coordinate pair, reading it in the given axisOrder.

public static GeoPosition? ParsePos(string posValue, GmlAxisOrder axisOrder)

Parameters

posValue string
axisOrder GmlAxisOrder

Returns

GeoPosition?

The parsed (latitude, longitude) pair, or null if parsing fails.

ParsePosList(string)

Parses a gml:posList value into a sequence of coordinate pairs, latitude first.

public static IReadOnlyList<GeoPosition> ParsePosList(string posListValue)

Parameters

posListValue string

Returns

IReadOnlyList<GeoPosition>

ParsePosList(string, GmlAxisOrder)

Parses a gml:posList value into a sequence of coordinate pairs, reading it in the given axisOrder.

public static IReadOnlyList<GeoPosition> ParsePosList(string posListValue, GmlAxisOrder axisOrder)

Parameters

posListValue string
axisOrder GmlAxisOrder

Returns

IReadOnlyList<GeoPosition>

ParseSurfaceCoordinates(XElement)

Parses surface coordinates (exterior ring and optional interior rings) from a GML surface property element.

public static (IReadOnlyList<GeoPosition> ExteriorRing, IReadOnlyList<IReadOnlyList<GeoPosition>> InteriorRings) ParseSurfaceCoordinates(XElement surfaceContainer)

Parameters

surfaceContainer XElement

Returns

(IReadOnlyList<GeoPosition> ExteriorRing, IReadOnlyList<IReadOnlyList<GeoPosition>> InteriorRings)

ParseSurfaceCoordinates(XElement, GmlAxisOrder)

Parses surface coordinates (exterior ring and optional interior rings) from a GML surface property element, reading them in the given axisOrder.

public static (IReadOnlyList<GeoPosition> ExteriorRing, IReadOnlyList<IReadOnlyList<GeoPosition>> InteriorRings) ParseSurfaceCoordinates(XElement surfaceContainer, GmlAxisOrder axisOrder)

Parameters

surfaceContainer XElement
axisOrder GmlAxisOrder

Returns

(IReadOnlyList<GeoPosition> ExteriorRing, IReadOnlyList<IReadOnlyList<GeoPosition>> InteriorRings)

ReadEnvelope(XElement)

Reads the dataset's declared gml:Envelope (the root gml:boundedBy, else the first envelope in the document) latitude first, or returns null when there is none.

public static BoundingBox? ReadEnvelope(XElement root)

Parameters

root XElement

Returns

BoundingBox