I'm using geolib to get Point is within the circle, and the below function returns only TRUE/FALSE.
geolib.isPointWithinRadius(
{ latitude: 51.525, longitude: 7.4575 }, // My current location.
{ latitude: 51.5175, longitude: 7.4678 }, // returns TRUE if this point is within 5 km radius from my current location.
5000
);
and yes it's working. But what i want is, i want to check multiple locations. for ex, i have below array, and i want to check the same function to check all the locaions, if any one of location is within 5 km from my locaion it should return TRUE. in other words, i will be getting FALSE only when none of the locations are within 5 km of my current location
const markers = [
{
title: "my location1",
coordinates: {
latitude: 14.599912,
longitude: 24.1147557,
},
},
{
title: "my location 2",
coordinates: {
latitude: 34.599912,
longitude: 44.1147557,
},
},
{
title: "my location 3",
coordinates: {
latitude: 54.599912,
longitude: 64.1147557,
},
},
];
I tried this,
geolib.isPointWithinRadius(
{ latitude: 51.525, longitude: 7.4575 },
markers.map((marker) => marker.coordinates),
50
);
i get only false, i would really appreciate your help. Thanks in advance.