Table of Contents

Class GeoMath

Namespace
LansMap.Core.Geo

Geodesic distance helpers for map tools such as measuring and headings.

public static class GeoMath
Inheritance
object
GeoMath

Remarks

Spherical earth, not the WGS84 ellipsoid, so distances carry up to about 0.56 percent error against a geodesic. Always the short way around, including across the antimeridian. This uses the mean earth radius while MarkerMath uses the equatorial circumference, by design: a haversine wants the mean radius and the mercator scale is defined at the equator. Do not show more precision than that bound carries.

Fields

EarthRadiusMeters

Mean earth radius in meters, 6371008.8, the IUGG arithmetic mean.

public const double EarthRadiusMeters = 6371008.8

Field Value

double

Methods

DistanceMeters(LatLon, LatLon)

Great-circle distance between two coordinates, by the haversine formula.

public static double DistanceMeters(LatLon a, LatLon b)

Parameters

a LatLon

First coordinate, degrees WGS84.

b LatLon

Second coordinate, degrees WGS84.

Returns

double

Distance in meters along the surface. Always the short way around, so a pair spanning the antimeridian is handled correctly.

DistanceMeters3D(LatLon, double, LatLon, double)

Straight-line distance between two points at altitude, for lines drawn between aircraft.

public static double DistanceMeters3D(LatLon a, double altAMeters, LatLon b, double altBMeters)

Parameters

a LatLon

First coordinate, degrees WGS84.

altAMeters double

Altitude of the first point in meters.

b LatLon

Second coordinate, degrees WGS84.

altBMeters double

Altitude of the second point in meters.

Returns

double

Distance in meters: the ground distance and the altitude difference combined as the hypotenuse. Treats the ground arc as a straight leg, which is accurate while the separation is small next to the earth's radius.

InterpolateGreatCircle(LatLon, LatLon, double)

Point a fraction of the way from a to b along the great circle through them.

public static LatLon InterpolateGreatCircle(LatLon a, LatLon b, double fraction)

Parameters

a LatLon

Start coordinate, degrees WGS84.

b LatLon

End coordinate, degrees WGS84.

fraction double

0 returns a, 1 returns b.

Returns

LatLon

Interpolated coordinate, degrees WGS84.

Remarks

Spherical slerp on the same great circle DistanceMeters(LatLon, LatLon) measures, so a sum of DistanceMeters(LatLon, LatLon) over consecutive interpolated points recovers the original two-point distance.