Redis: How to get points in a given rectangle usin

2019-06-12 23:41发布

问题:

example: Given 3 points (1,1),(2,2),(5,5) and a rectangle (0,0)(3,3), get 2 points (1,1) and (2,2).

It's easy to get points in a circle using georadius, but it seems that there is not a convenient way to get points in a rectangle.

回答1:

There's no built-in way to do that.

However, you can do a spatial search with a circle that can cover the whole rectangle. For each retrieved point, check if it's inside the rectangle.



标签: redis gis