Table of Contents

Class Wgs84Geodesy

Namespace
EncDotNet.S100.Geodesy
Assembly
EncDotNet.S100.Core.dll

Geodesics and rhumb lines on the WGS-84 ellipsoid: distances, bearings, the direct problem and points along a line.

public static class Wgs84Geodesy
Inheritance
Wgs84Geodesy
Inherited Members

Remarks

Built on GeographicLib.NET, a C# port of GeographicLib (MIT; copyright Charles Karney and the GeographicLib.NET contributors; see THIRD-PARTY-NOTICES.md). It implements Karney, "Algorithms for geodesics" (2013) and "The area of rhumb polygons" (2024), so results agree with other navigation software to well under a millimetre and 0.001°.

Bearings are true, clockwise from north, in [0°, 360°). Returned longitudes are in [-180°, 180°]. A rhumb line can't pass a pole, so the direct problem stops at one.

Methods

GeodesicDestination(GeoPosition, double, double)

The position distanceMetres from origin along the geodesic that leaves it on bearingDegrees (the geodesic direct problem).

public static GeoPosition GeodesicDestination(GeoPosition origin, double bearingDegrees, double distanceMetres)

Parameters

origin GeoPosition

The start position.

bearingDegrees double

Initial true bearing in degrees.

distanceMetres double

Distance along the geodesic in metres.

Returns

GeoPosition

The end position.

GeodesicDistanceMetres(GeoPosition, GeoPosition)

Length in metres of the geodesic (shortest path) between two positions.

public static double GeodesicDistanceMetres(GeoPosition from, GeoPosition to)

Parameters

from GeoPosition

The start position.

to GeoPosition

The end position.

Returns

double

The distance in metres.

GeodesicInitialBearingDegrees(GeoPosition, GeoPosition)

The initial true bearing of the geodesic at from towards to. Coincident positions have bearing 0°.

public static double GeodesicInitialBearingDegrees(GeoPosition from, GeoPosition to)

Parameters

from GeoPosition

The start position.

to GeoPosition

The end position.

Returns

double

The bearing in degrees, in [0°, 360°).

GeodesicInterpolate(GeoPosition, GeoPosition, double)

The position a fraction of the way along the geodesic from from to to.

public static GeoPosition GeodesicInterpolate(GeoPosition from, GeoPosition to, double fraction)

Parameters

from GeoPosition

The start position.

to GeoPosition

The end position.

fraction double

Fraction of the distance, from 0 (start) to 1 (end).

Returns

GeoPosition

The interpolated position; the ends themselves at 0 and 1.

GeodesicPoints(GeoPosition, GeoPosition, int)

segments + 1 evenly spaced points along the geodesic from from to to. The first and last are the given positions exactly.

public static GeoPosition[] GeodesicPoints(GeoPosition from, GeoPosition to, int segments)

Parameters

from GeoPosition

The start position.

to GeoPosition

The end position.

segments int

Number of pieces; at least 1.

Returns

GeoPosition[]

The points, in order from start to end.

MetresPerDegree(double)

Metres per degree of latitude and of longitude at a latitude: the ellipsoid's local scale, for a flat east/north frame a few kilometres across.

public static (double North, double East) MetresPerDegree(double latitude)

Parameters

latitude double

Latitude in degrees.

Returns

(double X, double Y)

Metres per degree northward (from the meridional radius of curvature) and eastward (from the prime-vertical radius, times cos latitude).

RhumbBearingDegrees(GeoPosition, GeoPosition)

The constant true bearing of the shorter rhumb line from from to to. Coincident positions have bearing 0°.

public static double RhumbBearingDegrees(GeoPosition from, GeoPosition to)

Parameters

from GeoPosition

The start position.

to GeoPosition

The end position.

Returns

double

The bearing in degrees, in [0°, 360°).

RhumbDestination(GeoPosition, double, double)

The position distanceMetres from origin along the rhumb line on bearingDegrees. A line that would pass a pole ends at it.

public static GeoPosition RhumbDestination(GeoPosition origin, double bearingDegrees, double distanceMetres)

Parameters

origin GeoPosition

The start position.

bearingDegrees double

Constant true bearing in degrees.

distanceMetres double

Distance along the rhumb line in metres.

Returns

GeoPosition

The end position.

RhumbDistanceMetres(GeoPosition, GeoPosition)

Length in metres of the shorter rhumb line (loxodrome) between two positions.

public static double RhumbDistanceMetres(GeoPosition from, GeoPosition to)

Parameters

from GeoPosition

The start position.

to GeoPosition

The end position.

Returns

double

The distance in metres.

RhumbInterpolate(GeoPosition, GeoPosition, double)

The position a fraction of the way along the shorter rhumb line from from to to.

public static GeoPosition RhumbInterpolate(GeoPosition from, GeoPosition to, double fraction)

Parameters

from GeoPosition

The start position.

to GeoPosition

The end position.

fraction double

Fraction of the distance, from 0 (start) to 1 (end).

Returns

GeoPosition

The interpolated position; the ends themselves at 0 and 1.