GeoBounds Struct

A box of longitudes and latitudes, in degrees. A box that crosses the 180th meridian has its west side east of its east side, as RFC 7946 allows: new GeoBounds(177, -21, -178, -12) goes from the longitude 177 to 180, then from -180 to -178.

public readonly struct GeoBounds : IEquatable<GeoBounds>
Implements

Constructors

NameDescription
GeoBounds(double, double, double, double)A box of longitudes and latitudes, in degrees. A box that crosses the 180th meridian has its west side east of its east side, as RFC 7946 allows: new GeoBounds(177, -21, -178, -12) goes from the longitude 177 to 180, then from -180 to -178.

GeoBounds(double, double, double, double)

A box of longitudes and latitudes, in degrees. A box that crosses the 180th meridian has its west side east of its east side, as RFC 7946 allows: new GeoBounds(177, -21, -178, -12) goes from the longitude 177 to 180, then from -180 to -178.

public GeoBounds(double West, double South, double East, double North)

Parameters

West double
The westernmost longitude.
South double
The smallest latitude.
East double
The easternmost longitude. It is smaller than West when the box crosses the 180th meridian.
North double
The largest latitude.

Properties

NameDescription
EastThe easternmost longitude. It is smaller than West when the box crosses the 180th meridian.
NorthThe largest latitude.
SouthThe smallest latitude.
WestThe westernmost longitude.

The easternmost longitude. It is smaller than West when the box crosses the 180th meridian.

public double East { get; init; }

Property value

double

The largest latitude.

public double North { get; init; }

Property value

double

The smallest latitude.

public double South { get; init; }

Property value

double

The westernmost longitude.

public double West { get; init; }

Property value

double

Methods

NameDescription
Contains(GeoPosition)Gets a value that indicates whether a position is in the box, edges included. The altitude is ignored.
CrossesAntimeridian()Gets a value that indicates whether the box crosses the 180th meridian: its west side is east of its east side.
Deconstruct(double, double, double, double)
Equals(GeoBounds)
Equals(object)
FromPositions(IEnumerable<GeoPosition>)Gets the smallest box that contains positions.
GetHashCode()
Intersects(GeoBounds)Gets a value that indicates whether this box and another one have a part in common, edges included.
ToString()
Union(GeoBounds)Gets the smallest box that contains this box and another one.

Contains(GeoPosition)

GeoBounds.cs

Gets a value that indicates whether a position is in the box, edges included. The altitude is ignored.

public bool Contains(GeoPosition position)

Parameters

position GeoPosition
The position.

Returns

bool true when the position is in the box; otherwise, false.

CrossesAntimeridian()

GeoBounds.cs

Gets a value that indicates whether the box crosses the 180th meridian: its west side is east of its east side.

public bool CrossesAntimeridian()

Returns

bool true when the box crosses the 180th meridian; otherwise, false.

Remarks

It is a method, not a property, so that GeoBounds.ToString shows the four sides only.

Deconstruct(double, double, double, double)

public void Deconstruct(out double West, out double South, out double East, out double North)

Parameters

West double
South double
East double
North double

No documentation is available.

Equals overloads

Equals(GeoBounds)

public bool Equals(GeoBounds other)
Parameters
other GeoBounds
Returns

bool

No documentation is available.

Equals(object)

public override bool Equals(object obj)
Parameters
obj object
Returns

bool

No documentation is available.

FromPositions(IEnumerable<GeoPosition>)

GeoBounds.cs

Gets the smallest box that contains positions.

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

Parameters

positions IEnumerable<GeoPosition>
The positions.

Returns

GeoBounds? The box, or null when there is no position. It does not cross the 180th meridian.

GetHashCode()

public override int GetHashCode()

Returns

int

No documentation is available.

Intersects(GeoBounds)

GeoBounds.cs

Gets a value that indicates whether this box and another one have a part in common, edges included.

public bool Intersects(GeoBounds other)

Parameters

other GeoBounds
The other box.

Returns

bool true when the boxes intersect; otherwise, false.

ToString()

public override string ToString()

Returns

string

No documentation is available.

Union(GeoBounds)

GeoBounds.cs

Gets the smallest box that contains this box and another one.

public GeoBounds Union(GeoBounds other)

Parameters

other GeoBounds
The other box.

Returns

GeoBounds The box that contains both boxes. When neither box crosses the 180th meridian, the result does not cross it either: it goes from the westernmost to the easternmost side. Otherwise, the result is the shortest box that contains both, and it can cross the 180th meridian.

Operators

NameDescription
operator ==(GeoBounds, GeoBounds)
operator !=(GeoBounds, GeoBounds)

operator ==(GeoBounds, GeoBounds)

public static bool operator ==(GeoBounds left, GeoBounds right)

Parameters

left GeoBounds
right GeoBounds

Returns

bool

No documentation is available.

operator !=(GeoBounds, GeoBounds)

public static bool operator !=(GeoBounds left, GeoBounds right)

Parameters

left GeoBounds
right GeoBounds

Returns

bool

No documentation is available.