Class GmlCoordinateParser
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
rootXElementThe dataset root element.
Returns
- (GmlAxisOrder Order, AxisOrderAssessment Assessment)
LongitudeFirst when the check finds the dataset swapped, otherwise LatitudeFirst; and the assessment (or
nullwhen 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
curveContainerXElement
Returns
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
curveContainerXElementaxisOrderGmlAxisOrder
Returns
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
elementXElements100NsXNamespace
Returns
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
elementXElements100NsXNamespaceaxisOrderGmlAxisOrder
Returns
ParsePos(string)
Parses a gml:pos value into a single coordinate pair.
public static GeoPosition? ParsePos(string posValue)
Parameters
posValuestring
Returns
- GeoPosition?
The parsed (latitude, longitude) pair, or
nullif 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
posValuestringaxisOrderGmlAxisOrder
Returns
- GeoPosition?
The parsed (latitude, longitude) pair, or
nullif 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
posListValuestring
Returns
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
posListValuestringaxisOrderGmlAxisOrder
Returns
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
surfaceContainerXElement
Returns
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
surfaceContainerXElementaxisOrderGmlAxisOrder
Returns
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
rootXElement