summaryrefslogtreecommitdiff
path: root/deps/geohash-int/geohash_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/geohash-int/geohash_helper.c')
-rw-r--r--deps/geohash-int/geohash_helper.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/deps/geohash-int/geohash_helper.c b/deps/geohash-int/geohash_helper.c
index 4c3762faf..4b8894676 100644
--- a/deps/geohash-int/geohash_helper.c
+++ b/deps/geohash-int/geohash_helper.c
@@ -72,7 +72,7 @@ uint8_t geohashEstimateStepsByRadius(double range_meters, double lat) {
/* Frame to valid range. */
if (step < 1) step = 1;
- if (step > 26) step = 25;
+ if (step > 26) step = 26;
return step;
}
@@ -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;