Class GridGeoreferencing
- Namespace
- EncDotNet.S100.Validation
- Assembly
- EncDotNet.S100.Core.dll
CRS-aware plausibility checks for the georeferencing of an S-100 gridded
coverage (S-100 Part 10c §10.2.1.2). S-100 names the grid attributes
gridOriginLatitude / gridOriginLongitude whatever the CRS, so
for a projected grid — which S-102 Edition 3.0.0 and later product editions
allow — the values are metres and a latitude/longitude range check is wrong.
public sealed class GridGeoreferencing
- Inheritance
-
GridGeoreferencing
- Inherited Members
Remarks
Positions are passed in the grid's native axis order: x is longitude
or easting, y is latitude or northing.
For a geographic CRS a position must lie within [-90, 90] latitude and [-180, 180] longitude. For a UTM CRS (WGS 84, NAD83 or ETRS89 zones) the easting must lie in [0, 1 000 000] m and the northing in [0, 10 000 000] m. When an ICrsTransformFactory is available (see CrsTransformFactory) a projected position must also transform to a finite, in-range WGS 84 position, and TryGetGeographicBounds(double, double, double, double, out BoundingBox?) can reproject a grid extent for a finding's BoundingBox. Positions in a CRS classified as Unknown are not checked.
Properties
Epsg
The EPSG code of the grid's horizontal CRS, or null when undeclared.
public int? Epsg { get; }
Property Value
- int?
Kind
How the CRS shapes the grid's georeferencing values.
public HorizontalCrsKind Kind { get; }
Property Value
Methods
CheckPosition(double, double, string, string, string?)
Checks one grid position and describes each problem found; an empty list means the position is plausible (or the CRS is unknown).
public IReadOnlyList<string> CheckPosition(double x, double y, string xLabel, string yLabel, string? longitudeNote = null)
Parameters
xdoubleLongitude (geographic) or easting (projected).
ydoubleLatitude (geographic) or northing (projected).
xLabelstringHow messages name
x(e.g.OriginLongitude).yLabelstringHow messages name
y(e.g.OriginLatitude).longitudeNotestringOptional text appended to a geographic longitude problem (e.g. that antimeridian-spanning tiles are out of scope).
Returns
- IReadOnlyList<string>
The problems, one sentence fragment each.
Classify(int?)
Classifies an EPSG code as geographic, projected, or unknown. null is taken as geographic (the S-100 HDF5 default).
public static HorizontalCrsKind Classify(int? epsg)
Parameters
epsgint?The EPSG code.
Returns
- HorizontalCrsKind
The CRS kind.
For(int?, ValidationContext?)
Resolves the checks for a grid in the CRS epsg.
public static GridGeoreferencing For(int? epsg, ValidationContext? context)
Parameters
epsgint?The dataset's
horizontalCRSEPSG code. null is taken as geographic, the S-100 HDF5 default (WGS 84, EPSG:4326).contextValidationContextThe validation context; its CrsTransformFactory, when set, enables reprojection of projected positions to WGS 84.
Returns
- GridGeoreferencing
The checks for that CRS.
TryGetGeographicBounds(double, double, double, double, out BoundingBox?)
Computes the WGS 84 envelope of the native rectangle spanned by two opposite grid corners, for a finding's BoundingBox. A geographic rectangle is returned as-is (edges ordered, values unclamped); a projected one is reprojected corner by corner when a transform is available.
public bool TryGetGeographicBounds(double x0, double y0, double x1, double y1, out BoundingBox? bounds)
Parameters
x0doubleLongitude or easting of one corner.
y0doubleLatitude or northing of one corner.
x1doubleLongitude or easting of the opposite corner.
y1doubleLatitude or northing of the opposite corner.
boundsBoundingBoxThe geographic envelope, when available.