Table of Contents

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

South double

South edge, −90..+90.

West double

West edge, −180..+180.

North double

North edge, −90..+90.

East double

East 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

True when the box crosses the antimeridian (West > East).

public bool CrossesAntimeridian { get; }

Property Value

bool

East

East edge, −180..+180.

public double East { get; init; }

Property Value

double

LongitudeSpan

The longitudinal width of the box in degrees, accounting for antimeridian crossing.

public double LongitudeSpan { get; }

Property Value

double

North

North edge, −90..+90.

public double North { get; init; }

Property Value

double

South

South edge, −90..+90.

public double South { get; init; }

Property Value

double

West

West edge, −180..+180.

public double West { get; init; }

Property Value

double

Methods

Contains(GeoPosition)

Returns true when position lies inside the box (edges inclusive).

public bool Contains(GeoPosition position)

Parameters

position GeoPosition

Returns

bool

FromPositions(IEnumerable<GeoPosition>)

Computes the bounds of positions, or null when there are none.

public static GeoBounds? FromPositions(IEnumerable<GeoPosition> positions)

Parameters

positions IEnumerable<GeoPosition>

Returns

GeoBounds?

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

other GeoBounds

Returns

bool

NormalizeLongitude(double)

Maps a longitude into the range [−180, 180).

public static double NormalizeLongitude(double longitude)

Parameters

longitude double

Returns

double

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

other GeoBounds

Returns

GeoBounds

UnionAll(IEnumerable<GeoBounds>)

Unions a sequence of boxes, or returns null when empty.

public static GeoBounds? UnionAll(IEnumerable<GeoBounds> bounds)

Parameters

bounds IEnumerable<GeoBounds>

Returns

GeoBounds?