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
| Name | Description |
|---|---|
| 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.
Properties
| Name | Description |
|---|---|
| East | The easternmost longitude. It is smaller than West when the box crosses the 180th meridian. |
| North | The largest latitude. |
| South | The smallest latitude. |
| West | The westernmost longitude. |
East
GeoBounds.csNorth
GeoBounds.csSouth
GeoBounds.csWest
GeoBounds.csMethods
| Name | Description |
|---|---|
| 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.csGets a value that indicates whether a position is in the box, edges included. The altitude is ignored.
public bool Contains(GeoPosition position)Parameters
positionGeoPosition- The position.
Returns
bool true when the position is in the box; otherwise, false.
CrossesAntimeridian()
GeoBounds.csGets 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)
Equals overloads
Equals(GeoBounds)
Equals(object)
FromPositions(IEnumerable<GeoPosition>)
GeoBounds.csGets the smallest box that contains positions.
public static GeoBounds? FromPositions(IEnumerable<GeoPosition> positions)Parameters
positionsIEnumerable<GeoPosition>- The positions.
Returns
GeoBounds? The box, or null when there is no position. It does not cross the 180th meridian.
GetHashCode()
Intersects(GeoBounds)
GeoBounds.csToString()
Union(GeoBounds)
GeoBounds.csGets the smallest box that contains this box and another one.
Parameters
otherGeoBounds- 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
| Name | Description |
|---|---|
| operator ==(GeoBounds, GeoBounds) | |
| operator !=(GeoBounds, GeoBounds) |