Struct GeoBounds
- Namespace
- EncDotNet.S100.Collections
- Assembly
- EncDotNet.S100.Collections.dll
An axis-aligned geographic bounding box in decimal degrees (EPSG:4326).
public readonly record struct GeoBounds : IEquatable<GeoBounds>
- Implements
- Inherited Members
Remarks
A box that crosses the antimeridian is recorded with
West greater than East (for example
West = 172, East = -170 for the western Aleutians), the same
convention as the S-100 exchange-catalogue boundingBox.
Constructors
GeoBounds(double, double, double, double)
An axis-aligned geographic bounding box in decimal degrees (EPSG:4326).
public GeoBounds(double South, double West, double North, double East)
Parameters
SouthdoubleSouth edge, −90..+90.
WestdoubleWest edge, −180..+180.
NorthdoubleNorth edge, −90..+90.
EastdoubleEast edge, −180..+180.
Remarks
A box that crosses the antimeridian is recorded with
West greater than East (for example
West = 172, East = -170 for the western Aleutians), the same
convention as the S-100 exchange-catalogue boundingBox.
Properties
CrossesAntimeridian
public bool CrossesAntimeridian { get; }
Property Value
East
East edge, −180..+180.
public double East { get; init; }
Property Value
LongitudeSpan
The longitudinal width of the box in degrees, accounting for antimeridian crossing.
public double LongitudeSpan { get; }
Property Value
North
North edge, −90..+90.
public double North { get; init; }
Property Value
South
South edge, −90..+90.
public double South { get; init; }
Property Value
West
West edge, −180..+180.
public double West { get; init; }
Property Value
Methods
Contains(GeoPosition)
Returns true when position lies inside the box (edges inclusive).
public bool Contains(GeoPosition position)
Parameters
positionGeoPosition
Returns
FromPositions(IEnumerable<GeoPosition>)
Computes the bounds of positions, or
null when there are none.
public static GeoBounds? FromPositions(IEnumerable<GeoPosition> positions)
Parameters
positionsIEnumerable<GeoPosition>
Returns
Remarks
Longitudes may be continuous beyond ±180 (as NOAA publishes western Pacific coverage); the result is normalised to −180..180. When positions already within −180..180 span more than 180° of longitude they are assumed to cross the antimeridian: the result runs from the smallest non-negative longitude east across ±180° to the largest negative one.
Intersects(GeoBounds)
Returns true when this box and other overlap (edges inclusive).
public bool Intersects(GeoBounds other)
Parameters
otherGeoBounds
Returns
NormalizeLongitude(double)
Maps a longitude into the range [−180, 180).
public static double NormalizeLongitude(double longitude)
Parameters
longitudedouble
Returns
Union(GeoBounds)
Returns the smallest box containing both this box and
other, choosing the shorter way around the globe for
the longitude range.
public GeoBounds Union(GeoBounds other)
Parameters
otherGeoBounds
Returns
UnionAll(IEnumerable<GeoBounds>)
Unions a sequence of boxes, or returns null when empty.
public static GeoBounds? UnionAll(IEnumerable<GeoBounds> bounds)
Parameters
boundsIEnumerable<GeoBounds>