diff options
author | antirez <antirez@gmail.com> | 2016-05-30 12:45:49 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2016-06-13 12:11:15 +0200 |
commit | bb43f4cab2f756c0412ca2b94d9e29c3db5025ab (patch) | |
tree | bc48ba922e52ca59f9ea0e2f29979ff53d9d2acf | |
parent | 16102bc0af0912a0c9a92aedddf796eb24a80b9e (diff) | |
download | redis-bb43f4cab2f756c0412ca2b94d9e29c3db5025ab.tar.gz |
Fix GEORADIUS wrong output with radius > Earth radius.
Close #3266
-rw-r--r-- | deps/geohash-int/geohash_helper.c | 2 |
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; |