From f21d7a848cda1c9b9c45059dc53d8e92fdf19a2a Mon Sep 17 00:00:00 2001 From: Philipp Thiele Date: Fri, 19 Mar 2021 08:27:35 +0100 Subject: [PATCH] [BUGFIX] fixes calcuation of longitude boundaries The values for highest / lowest longitude are too small, resulting in missing records in result list. --- Classes/Domain/Repository/EntryRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Repository/EntryRepository.php b/Classes/Domain/Repository/EntryRepository.php index 1118d3c1..82b05f50 100755 --- a/Classes/Domain/Repository/EntryRepository.php +++ b/Classes/Domain/Repository/EntryRepository.php @@ -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),