|
| 1 | +--- |
| 2 | +categories: |
| 3 | +- docs |
| 4 | +- develop |
| 5 | +- stack |
| 6 | +- oss |
| 7 | +- rs |
| 8 | +- rc |
| 9 | +- oss |
| 10 | +- kubernetes |
| 11 | +- clients |
| 12 | +description: Learn how to use geospatial fields and perform geospatial queries in Redis |
| 13 | +linkTitle: Geospatial |
| 14 | +math: true |
| 15 | +title: Geospatial |
| 16 | +weight: 14 |
| 17 | +--- |
| 18 | + |
| 19 | +Redis Query Engine supports geospatial data. This feature |
| 20 | +lets you store geographical locations in the fields of JSON objects. |
| 21 | +You can then use queries to find the objects by their location. |
| 22 | +For example, if you add the locations of a set of shops, you can |
| 23 | +find all the shops within 5km of a user's position. |
| 24 | + |
| 25 | +Redis uses coordinate points to represent geospatial locations. |
| 26 | +You can store individual points but you can also |
| 27 | +use a set of points to define a polygon shape (the shape of a |
| 28 | +town, for example). You can query several types of interactions |
| 29 | +between points and shapes, such as whether a point lies within |
| 30 | +a shape or whether two shapes overlap. |
| 31 | + |
| 32 | +You can interpret coordinates either as geographical longitude |
| 33 | +and latitude or as Cartesian coordinates on a flat plane. |
| 34 | +Geographical coordinates are ideal for large real-world locations |
| 35 | +and areas (such as towns and countries). Cartesian coordinates |
| 36 | +are more suitable for smaller areas (such as rooms in a building) |
| 37 | +or for games, simulations, and other artificial scenarios. |
| 38 | + |
| 39 | +## Storing geospatial data |
| 40 | + |
| 41 | +Redis Query Engine uses the |
| 42 | +[*Well-Known Text*](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) |
| 43 | +format for geospatial data, specifically the `POINT` and `POLYGON` |
| 44 | +constructs. |
| 45 | + |
| 46 | +### `POINT` data |
| 47 | + |
| 48 | + |
0 commit comments