summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-06-29 12:44:31 +0200
committerantirez <antirez@gmail.com>2015-06-29 12:44:34 +0200
commitf108c687ad122d76e8468f98934255ffb51cc7e8 (patch)
tree2160d798dc707eded4409fb2818fbb540e6e71c2 /deps
parenta12192f5ff33298eb7082cc3f6e2de17957e7d26 (diff)
downloadredis-f108c687ad122d76e8468f98934255ffb51cc7e8.tar.gz
Geo: GEODIST and tests.
Diffstat (limited to 'deps')
-rw-r--r--deps/geohash-int/geohash_helper.c4
-rw-r--r--deps/geohash-int/geohash_helper.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/deps/geohash-int/geohash_helper.c b/deps/geohash-int/geohash_helper.c
index 729f010ea..88a972b47 100644
--- a/deps/geohash-int/geohash_helper.c
+++ b/deps/geohash-int/geohash_helper.c
@@ -167,7 +167,7 @@ GeoHashFix52Bits geohashAlign52Bits(const GeoHashBits hash) {
}
/* Calculate distance using haversin great circle distance formula. */
-double distanceEarth(double lon1d, double lat1d, double lon2d, double lat2d) {
+double geohashGetDistance(double lon1d, double lat1d, double lon2d, double lat2d) {
double lat1r, lon1r, lat2r, lon2r, u, v;
lat1r = deg_rad(lat1d);
lon1r = deg_rad(lon1d);
@@ -182,7 +182,7 @@ double distanceEarth(double lon1d, double lat1d, double lon2d, double lat2d) {
int geohashGetDistanceIfInRadius(double x1, double y1,
double x2, double y2, double radius,
double *distance) {
- *distance = distanceEarth(x1, y1, x2, y2);
+ *distance = geohashGetDistance(x1, y1, x2, y2);
if (*distance > radius) return 0;
return 1;
}
diff --git a/deps/geohash-int/geohash_helper.h b/deps/geohash-int/geohash_helper.h
index 0e38740de..70c6b2095 100644
--- a/deps/geohash-int/geohash_helper.h
+++ b/deps/geohash-int/geohash_helper.h
@@ -58,6 +58,8 @@ GeoHashRadius geohashGetAreasByRadiusWGS84(double longitude, double latitude,
GeoHashRadius geohashGetAreasByRadiusMercator(double longitude, double latitude,
double radius_meters);
GeoHashFix52Bits geohashAlign52Bits(const GeoHashBits hash);
+double geohashGetDistance(double lon1d, double lat1d,
+ double lon2d, double lat2d);
int geohashGetDistanceIfInRadius(double x1, double y1,
double x2, double y2, double radius,
double *distance);