hi,
I need to find the the latitude langitude value is inside the Radius circle or not.if its is outside i have to pass some value from my MVC Controller.
i have tried this but data comes wrong distance, if the distance is acroos from the radius line i have to show some notification. if anybody knows this please help me for the same
- function distance(lat1,lon1,lat2,lon2)
- {
- var R = 6371; // Earth's radius in Km
- return Math.acos(Math.sin(lat1)*Math.sin(lat2) +
- Math.cos(lat1)*Math.cos(lat2) *
- Math.cos(lon2-lon1)) * R; }
- if (distance(user.lat, user.lon, post.lat, post.lon) <= desiredRadiusInKm)
- { // return true;
- } else
- { // return false;
- }
i have tried this but data comes wrong distance,
if the distance is across from the radius line i have to show some notification. if anybody knows this please help me for the same
Thanks,
Replies
Know the answer? Post it — somebody with the same question will find it here.