Struct LatLng
A geographic coordinate expressed in degrees.
public readonly record struct LatLng : IEquatable<LatLng>
- Implements
- Inherited Members
Remarks
This is the public, degrees-based coordinate type. The underlying H3 C library operates in radians; conversion happens only at the interop boundary.
Constructors
LatLng(double, double)
A geographic coordinate expressed in degrees.
public LatLng(double LatitudeDegrees, double LongitudeDegrees)
Parameters
LatitudeDegreesdoubleLatitude in degrees, in the range [-90, 90].
LongitudeDegreesdoubleLongitude in degrees, in the range [-180, 180].
Remarks
This is the public, degrees-based coordinate type. The underlying H3 C library operates in radians; conversion happens only at the interop boundary.
Properties
LatitudeDegrees
Latitude in degrees, in the range [-90, 90].
public double LatitudeDegrees { get; init; }
Property Value
LongitudeDegrees
Longitude in degrees, in the range [-180, 180].
public double LongitudeDegrees { get; init; }
Property Value
Methods
DegsToRads(double)
Converts an angle from degrees to radians.
public static double DegsToRads(double degrees)
Parameters
degreesdoubleThe angle to convert, in degrees.
Returns
- double
The equivalent angle in radians.
GreatCircleDistanceKm(LatLng, LatLng)
Returns the great-circle (haversine) distance between two coordinates in kilometers.
public static double GreatCircleDistanceKm(LatLng a, LatLng b)
Parameters
Returns
- double
The great-circle distance in kilometers.
GreatCircleDistanceM(LatLng, LatLng)
Returns the great-circle (haversine) distance between two coordinates in meters.
public static double GreatCircleDistanceM(LatLng a, LatLng b)
Parameters
Returns
- double
The great-circle distance in meters.
GreatCircleDistanceRads(LatLng, LatLng)
Returns the great-circle (haversine) distance between two coordinates in radians.
public static double GreatCircleDistanceRads(LatLng a, LatLng b)
Parameters
Returns
- double
The great-circle distance in radians.
RadsToDegs(double)
Converts an angle from radians to degrees.
public static double RadsToDegs(double radians)
Parameters
radiansdoubleThe angle to convert, in radians.
Returns
- double
The equivalent angle in degrees.
Validate()
Validates that LatitudeDegrees and LongitudeDegrees are finite and within the canonical degree ranges.
public void Validate()
Exceptions
- ArgumentOutOfRangeException
Latitude is outside [-90, 90], or longitude is outside [-180, 180], or either component is not a finite number.