0
votes

Not sure if this has been answered but can't seem to find a answer anywhere.

I currently have a app for windows phone 7.1 with bing maps as part of my page. I can add puspins to the map at my location by clicking a button. My question is, is it possible to get the distance between two pushpins?

I do not want to go into the bing maps application itself and calculate a route.

1
Possible duplicate question: stackoverflow.com/questions/10175724/…Gambit

1 Answers

0
votes

The way I did it in my app is to create a GeoCoordinate for each PushPin and use the GetDistanceTo method of one GeoCoordinate to determine its distance from another GeoCoordinate (created from another PushPin). Something like this, determining distance from pushpin1 to pushpin2:

GeoCoordinate geo1 = new GeoCoordinate(pushpin1.Location.Latitude, pushpin.Location.Longitude);
GeoCoordinate geo2 = new GeoCoordinate(pushpin2.Location.Latitude, pushpin.Location.Longitude);
double distance = geo1.GetDistanceTo(geo2);