Search code examples
c#gpsmapscoordinatescalculus

A new coordinate 50metres away from another in C#, how?


I have a coordinate and a heading, how do I get a second coordinate say 50 metres away from the first one in a C# function?

Example info:

Lat: 56.33908260  
Lon: 17.01194088

Radians:             -1.7453292519943295  
RadiansToDegrees:     57.295779513082323  
GeographicalDegrees: -170.0  
MathematicalDegrees: -100.00

Solution

  • It depends on the geodetic system you are using/want to use.

    Geodetic systems or geodetic data are used [...] to translate positions indicated on their products to their real position on earth.

    One of the most commonly used systems is WGS 84.

    Some background: https://math.stackexchange.com/questions/720/how-to-calculate-a-heading-on-the-earths-surface

    What you are looking for looks like the "Direct problem" to me. http://en.wikipedia.org/wiki/Vincenty's_formulae#Direct_Problem

    Here you can find an implementation in C++ which should be rather easy to port (respect the licence):

    https://github.com/pkohut/GeoFormulas/blob/master/GeoFormulas/VincentyDestination.cpp

    This implementation is derived from this formula: http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html