Skip to content

Commit

Permalink
Merge pull request #27 from phth/bugfix/coord-constraints
Browse files Browse the repository at this point in the history
[BUGFIX] fixes calcuation of longitude boundaries
  • Loading branch information
sabbelasichon authored Mar 19, 2021
2 parents 7822616 + f21d7a8 commit 1561dda
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/Domain/Repository/EntryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ private function createCoordsConstraints(

$lowestLat = (double)$userLocation->getLatitude() - rad2deg($radius / $earthRadius);
$highestLat = (double)$userLocation->getLatitude() + rad2deg($radius / $earthRadius);
$lowestLng = (double)$userLocation->getLongitude() - rad2deg($radius / $earthRadius);
$highestLng = (double)$userLocation->getLongitude() + rad2deg($radius / $earthRadius);
$lowestLng = (double)$userLocation->getLongitude() - rad2deg(asin($radius / $earthRadius) / cos(deg2rad($userLocation->getLatitude())));
$highestLng = (double)$userLocation->getLongitude() + rad2deg(asin($radius / $earthRadius) / cos(deg2rad($userLocation->getLatitude())));

return [
$query->greaterThanOrEqual('latitude', $lowestLat),
Expand Down

0 comments on commit 1561dda

Please sign in to comment.