Answered by:
Get distance between places on WinRT 8.1.
Question

I want to use geofence classes and logic in my app. There events that fires when user entering or exiting some geofence area, and i think, there are some processes, that are looking for a distance between user and center of geofence area. May be I can take distance from there? If not, how can I get distance between 2 location points in 8.1?
 Edited by Sergey Kot Thursday, October 31, 2013 9:32 AM
Thursday, October 31, 2013 9:32 AM
Answers

The Haversine formula should be fine for short distances, but since there isn't much curvature it won't be very different from using the simpler distance formula ( √(Δx²+Δy²) )
Rob
 Marked as answer by Jeff SandersMicrosoft employee, Moderator Tuesday, November 26, 2013 4:42 PM
Tuesday, November 5, 2013 5:00 PMModerator
All replies

You'll have to do the math. Get the latitude and longitude of your two points and calculate the distance. You can use the Haversine formula to find the great circle distance (see http://en.wikipedia.org/wiki/Haversine_formula ), though for close points the straight distance may be sufficient.
Rob
Thursday, October 31, 2013 2:11 PMModerator 
I want to use geofence classes and logic in my app. There events that fires when user entering or exiting some geofence area, and i think, there are some processes, that are looking for a distance between user and center of geofence area. May be I can take distance from there? If not, how can I get distance between 2 location points in 8.1?
Do you want the distance as travelled by road or simply the straight line (actually 'geodesic') distance between two points in the globe?
Cap'n
Thursday, October 31, 2013 3:51 PM 
Rob, Haversine formula is not good for me, because i need good precision for short distances. Do geofence classes calculate distances using this formula? If yes, haversine formula will be norm decision :)Thursday, October 31, 2013 4:26 PM

simply the straight line (actually 'geodesic')Thursday, October 31, 2013 4:26 PM

The Haversine formula should be fine for short distances, but since there isn't much curvature it won't be very different from using the simpler distance formula ( √(Δx²+Δy²) )
Rob
 Marked as answer by Jeff SandersMicrosoft employee, Moderator Tuesday, November 26, 2013 4:42 PM
Tuesday, November 5, 2013 5:00 PMModerator