I'm explaining with an example to achieve my result.
I have a users table. Each user has their location with latitude and longitude on the database. I'm using firebase database. So the DB looks like:
users {
user-id{
location{
latitude
longitude
}
}
}
I need to find users within a circle using my current location.
I've looked into geolib and found a method isPointInCircle . But using this, we need to iterate users data and needs to call this method on each loop. I need to avoid this multiple calls and achieve with only one method call like:
findNearestUsers(currentLocation,userLocations);
The result should be an array having nearest locations. How can I do this? Thanks in advance :)