summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-05-30 12:45:49 +0200
committerantirez <antirez@gmail.com>2016-06-13 12:11:15 +0200
commitbb43f4cab2f756c0412ca2b94d9e29c3db5025ab (patch)
treebc48ba922e52ca59f9ea0e2f29979ff53d9d2acf
parent16102bc0af0912a0c9a92aedddf796eb24a80b9e (diff)
downloadredis-bb43f4cab2f756c0412ca2b94d9e29c3db5025ab.tar.gz
Fix GEORADIUS wrong output with radius > Earth radius.
Close #3266
-rw-r--r--deps/geohash-int/geohash_helper.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/deps/geohash-int/geohash_helper.c b/deps/geohash-int/geohash_helper.c
index 437637015..4b8894676 100644
--- a/deps/geohash-int/geohash_helper.c
+++ b/deps/geohash-int/geohash_helper.c
@@ -89,6 +89,8 @@ int geohashBoundingBox(double longitude, double latitude, double radius_meters,
lonr = deg_rad(longitude);
latr = deg_rad(latitude);
+ if (radius_meters > EARTH_RADIUS_IN_METERS)
+ radius_meters = EARTH_RADIUS_IN_METERS;
double distance = radius_meters / EARTH_RADIUS_IN_METERS;
double min_latitude = latr - distance;
double max_latitude = latr + distance;