diff options
author | 杨博东 <bodong.ybd@alibaba-inc.com> | 2020-12-12 08:21:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-12 02:21:05 +0200 |
commit | 4d06d99bf8fc91289c79ae07110c92525ab1c1f8 (patch) | |
tree | 343f512de0c1b0d83c29e99189ba2b02a8f837cb /src/geohash_helper.h | |
parent | 8c291b97b95f2e011977b522acf77ead23e26f55 (diff) | |
download | redis-4d06d99bf8fc91289c79ae07110c92525ab1c1f8.tar.gz |
Add GEOSEARCH / GEOSEARCHSTORE commands (#8094)
Add commands to query geospatial data with bounding box.
Two new commands that replace the existing 4 GEORADIUS* commands.
GEOSEARCH key [FROMMEMBER member] [FROMLOC long lat] [BYRADIUS radius
unit] [BYBOX width height unit] [WITHCORD] [WITHDIST] [WITHASH] [COUNT
count] [ASC|DESC]
GEOSEARCHSTORE dest_key src_key [FROMMEMBER member] [FROMLOC long lat]
[BYRADIUS radius unit] [BYBOX width height unit] [WITHCORD] [WITHDIST]
[WITHASH] [COUNT count] [ASC|DESC] [STOREDIST]
- Add two types of CIRCULAR_TYPE and RECTANGLE_TYPE to achieve different searches
- Judge whether the point is within the rectangle, refer to:
geohashGetDistanceIfInRectangle
Diffstat (limited to 'src/geohash_helper.h')
-rw-r--r-- | src/geohash_helper.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/geohash_helper.h b/src/geohash_helper.h index eb0dda38a..f28896a8d 100644 --- a/src/geohash_helper.h +++ b/src/geohash_helper.h @@ -49,14 +49,8 @@ typedef struct { int GeoHashBitsComparator(const GeoHashBits *a, const GeoHashBits *b); uint8_t geohashEstimateStepsByRadius(double range_meters, double lat); -int geohashBoundingBox(double longitude, double latitude, double radius_meters, - double *bounds); -GeoHashRadius geohashGetAreasByRadius(double longitude, - double latitude, double radius_meters); -GeoHashRadius geohashGetAreasByRadiusWGS84(double longitude, double latitude, - double radius_meters); -GeoHashRadius geohashGetAreasByRadiusMercator(double longitude, double latitude, - double radius_meters); +int geohashBoundingBox(GeoShape *shape, double *bounds); +GeoHashRadius geohashCalculateAreasByShapeWGS84(GeoShape *shape); GeoHashFix52Bits geohashAlign52Bits(const GeoHashBits hash); double geohashGetDistance(double lon1d, double lat1d, double lon2d, double lat2d); @@ -66,5 +60,7 @@ int geohashGetDistanceIfInRadius(double x1, double y1, int geohashGetDistanceIfInRadiusWGS84(double x1, double y1, double x2, double y2, double radius, double *distance); +int geohashGetDistanceIfInRectangle(double *bounds, double x1, double y1, + double x2, double y2, double *distance); #endif /* GEOHASH_HELPER_HPP_ */ |