I am trying to filter locations using Latitude and longitude based on radius.
I have 10 companies’ data in the same building in Oman (Coral building, Muscat, Oman) and all 10 companies’ latitude and longitude are the same:
Latitude: 23.59498176 , Longitude: 58.4425843
I am searching 0 to 5 KM radius with this:
Latitude: 23.59498176 , Longitude: 58.4425843
But I am only getting 5 companies.
After that for testing I am trying to use different locations from India and USA.
In India I am trying this location:
Latitude: 21.2323783, Longitude: 72.8348966
I am searching 0 to 5 KM radius with this:
Latitude: 21.2323783, Longitude: 72.8348966
and I am getting all 10 companies.
In USA I am trying this location:
Latitude: 38.8854343, Longitude: -77.1004176
I am searching 0 to 5 KM radius with this :
Latitude: 38.8854343, Longitude: -77.1004176
and I am getting all 10 companies.
I am calculating the location from this PHP code:
$latFrom = deg2rad($latitudeFrom);
$lonFrom = deg2rad($longitudeFrom);
$latTo = deg2rad($latitudeTo);
$lonTo = deg2rad($longitudeTo);
$latDelta = $latTo - $latFrom;
$lonDelta = $lonTo - $lonFrom;
$a = sin($latDelta / 2) * sin($latDelta / 2) +
cos($latFrom) * cos($latTo) *
sin($lonDelta / 2) * sin($lonDelta / 2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
return $earthRadius * $c; // Distance in kilometers
This issue is in only in the country of Oman.
So I need to know, is there any security issue or any other reason for this?