I found a lot of solutions to calculate the distance between two locations, just like how to find the distance between two geopoints? or Calculating distance between two geographic locations or to be more specific, here's a code for the .distanceTo method:
Location locationA = new Location("point A");
locationA.setLatitude(pointA.getLatitudeE6() / 1E6);
locationA.setLongitude(pointA.getLongitudeE6() / 1E6);
Location locationB = new Location("point B");
locationB.setLatitude(pointB.getLatitudeE6() / 1E6);
locationB.setLongitude(pointB.getLongitudeE6() / 1E6);
double distance = locationA.distanceTo(locationB);
If I have a location (let's say "locationA"), and I have a database with POI-location data, and I'm interested in only those, what are around that location "locationA" within a given distance (let's say "distance"), how do I get those?
If I write a method
private Location[] poiAroundMe (Location locationA, double distance) {
// The necessary calculation
return locationsAroundMeWithinTheGivenDistance[];
}
what would be "the necessary calculation"?
I'm pretty sure, that there's no built-in method for that, so I would like to ask for help.
Thank you!