Reputation: 63369
I have a set of data which is the coordinates of friends, I am wondering that does google provide the service that can help me to find the nearby friends(say within 5KM) given a coordinate(longtitude, latitude)?
Or any other alternatives to make the things easier? I just don't want to reinvent the wheel :)
Upvotes: 0
Views: 556
Reputation: 6004
I don't think google provide any sort of API that could be used by you for your solution.
The most feasible solution I see is, sending the lat long to server and then calculating the distance between each point for the given lat long pair. And if the friend is within the mentioned radius (say 5 KM ), return the friends info back to client.
You can find information to calculate distance at following link.
http://www.movable-type.co.uk/scripts/latlong.html
One thing you can do is, divide the friends data in continents or countries if possible for minimizing the checks at server side.
Upvotes: 2