Daniel Ballinger
Daniel Ballinger

Reputation: 13537

Inverse of the System.Device.Location.GeoCoordinate.GetDistanceTo() Method

I have an instance of GeoCoordinate from the Bing Maps Silverlight control. I'm trying to draw a line on the map control at a given bearing.

My current approach is to:

  1. Figure out a distance suitable for the current ZoomLevel.
  2. Combine this distance with the bearing to find the corresponding destination GeoCoordinate.
  3. Add a MapPolyline from the origin GeoCoordinate to the destination GeoCoordinate in a MapLayer.

The GetDistanceTo method performs the reverse operation, but I can't find a method that takes the bearing and distance and results in a GeoCoordinate.

Is there a method I can call with the origin GeoCoordinate, bearing and distance that will find the destination GeoCoordinate?

Upvotes: 1

Views: 843

Answers (1)

Daniel Ballinger
Daniel Ballinger

Reputation: 13537

As a stub answer, lets assume that the framework doesn't currently have a method for finding a GeoCoordinate given:

  • A origin GeoCoordinate,
  • a bearing,
  • and distance to travel.

In this case the C# Geodesy Library for GPS – Vincenty’s Formulae is a good place to get code to do the calculation. I haven't yet figured out which reference ellipsoid model to use so that the GetDistanceTo() method can reverse the operation.

I'm still wondering if there is any built in support for solving what I now know is referred to as the First geodetic problem.

Upvotes: 1

Related Questions