Geolocation distance from current location
I'm trying to find an example of how to calculate the distance from the current location to a POI. I have a list of POIs that I need to display in a tableview along with the distance value based on the current location.
Thanks
3 Answers

var velo = {}; velo.getDistance = function(lat1,lon1,lat2,lon2) { var R = 6371000000; // m (change this constant to get miles) var dLat = (lat2lat1) * Math.PI / 180; var dLon = (lon2lon1) * Math.PI / 180; var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1 * Math.PI / 180 ) * Math.cos(lat2 * Math.PI / 180 ) * Math.sin(dLon/2) * Math.sin(dLon/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1a)); var d = R * c; return Math.round(d); };

I believe you will find this and more at this link
A similar question in stack overflow might give you more insight on the issues involved in calculating distances

Answered well here.