Table of Contents

Class GeographicBoundingBox

Namespace
Honua.Sdk.Geometry
Assembly
Honua.Sdk.Geometry.dll

Represents a WGS84 geographic bounding box defined by longitude and latitude extents expressed in decimal degrees.

public sealed record GeographicBoundingBox : IEquatable<GeographicBoundingBox>
Inheritance
GeographicBoundingBox
Implements
Inherited Members

Remarks

This type is intentionally CRS-free; coordinates are always interpreted as EPSG:4326 (WGS84) longitude/latitude. For a CRS-aware bounding box that supports arbitrary spatial references, use FeatureBoundingBox.

Constructors

GeographicBoundingBox(double, double, double, double)

Initializes a new instance of the GeographicBoundingBox record, validating that all coordinates are finite and within the WGS84 ranges, and that the southern boundary is strictly less than the northern boundary.

public GeographicBoundingBox(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude)

Parameters

minLongitude double

Western boundary in decimal degrees, within [-180, 180].

minLatitude double

Southern boundary in decimal degrees, within [-90, 90].

maxLongitude double

Eastern boundary in decimal degrees, within [-180, 180].

maxLatitude double

Northern boundary in decimal degrees, within [-90, 90].

Remarks

A box whose minLongitude is greater than its maxLongitude is interpreted as an extent that crosses the antimeridian (±180°), spanning eastward from the western edge across 180° to the eastern edge. See CrossesAntimeridian.

Exceptions

ArgumentException

Thrown when any coordinate is not finite, when a longitude falls outside [-180, 180], when a latitude falls outside [-90, 90], or when minLatitude is not strictly less than maxLatitude.

Fields

Wgs84CrsIdentifier

The canonical WGS84 CRS identifier used when converting to FeatureBoundingBox.

public const string Wgs84CrsIdentifier = "EPSG:4326"

Field Value

string

Properties

CrossesAntimeridian

Gets a value indicating whether this bounding box crosses the antimeridian (±180°), which is the case when MinLongitude is greater than MaxLongitude. When true, the longitudinal extent wraps eastward from MinLongitude across 180° to MaxLongitude.

public bool CrossesAntimeridian { get; }

Property Value

bool

LongitudeSpan

Gets the longitudinal span of this bounding box in decimal degrees, accounting for antimeridian wrapping. For a non-crossing box this is MaxLongitude - MinLongitude; for an antimeridian-crossing box it is (180 - MinLongitude) + (MaxLongitude - (-180)).

public double LongitudeSpan { get; }

Property Value

double

MaxLatitude

Gets the northern boundary in decimal degrees.

public double MaxLatitude { get; }

Property Value

double

MaxLongitude

Gets the eastern boundary in decimal degrees.

public double MaxLongitude { get; }

Property Value

double

MinLatitude

Gets the southern boundary in decimal degrees.

public double MinLatitude { get; }

Property Value

double

MinLongitude

Gets the western boundary in decimal degrees.

public double MinLongitude { get; }

Property Value

double

Methods

Contains(double, double)

Determines whether the supplied WGS84 coordinate lies on or within this bounding box, accounting for antimeridian wrapping.

public bool Contains(double longitude, double latitude)

Parameters

longitude double

Longitude in decimal degrees.

latitude double

Latitude in decimal degrees.

Returns

bool

true when the coordinate is on or inside the box; otherwise false.

FromFeatureBoundingBox(FeatureBoundingBox)

Creates a GeographicBoundingBox from a CRS-aware FeatureBoundingBox, ensuring the source CRS is WGS84.

public static GeographicBoundingBox FromFeatureBoundingBox(FeatureBoundingBox bbox)

Parameters

bbox FeatureBoundingBox

The CRS-aware bounding box to convert.

Returns

GeographicBoundingBox

An equivalent WGS84 GeographicBoundingBox.

Exceptions

ArgumentNullException

Thrown when bbox is null.

ArgumentException

Thrown when bbox declares a non-WGS84 CRS, or when its coordinate extents are invalid.

Intersects(GeographicBoundingBox)

Determines whether this bounding box intersects another WGS84 bounding box. Boxes that share only an edge are considered to intersect.

public bool Intersects(GeographicBoundingBox other)

Parameters

other GeographicBoundingBox

The other bounding box to test against.

Returns

bool

true when the two boxes overlap or touch; otherwise false.

Exceptions

ArgumentNullException

Thrown when other is null.

ToFeatureBoundingBox()

Creates a CRS-aware FeatureBoundingBox representation of this geographic bounding box, tagged with the canonical WGS84 CRS identifier.

public FeatureBoundingBox ToFeatureBoundingBox()

Returns

FeatureBoundingBox

A FeatureBoundingBox with Crs = "EPSG:4326".