![]() You can also return members within a radius of another member in the set: > GEORADIUSBYMEMBER cars robins-car 100 m This returns all the members with 100 meters of the point given. Now, let’s see what items are in a radius from a certain point: > GEORADIUS cars -115.17258 36.11996 100 m You can also use miles (mi) or kilometers (km). This has pulled the same distance in feet. You can also specify other units: > GEODIST cars my-car robins-car ft This means the two vehicles are about 90 meters apart. ![]() Looking at the coordinates, you can tell these two cars are quite close, but how close? You can determine this by running the GEODIST command. Let’s add a second car to the “cars” set – this time it’s driven by Robin: > GEOADD cars -115.171971 36.120609 robins-car This works because the geo index is just a set-repeated items are not allowed. To update the location of the car, you’ll just need to run the command again with new coordinates. The first argument is the set we’re adding to, the second is the longitude, third is the latitude and the fourth is the member name. To add car to the set, we can run the command: > GEOADD cars -115.17087 36.12306 my-car We’ll say your specific car can be identified as the member “my-car” (we use the term member because a geo index is just a form of a set). As an example, let’s assume you are tracking a group of cars as they travel down the road – we’ll call this set of cars simply “cars”. This is achieved by encoding the latitude and longitude into the score of the sorted set using the geohash algorithm.Īdding items to a geospatial index is easy. These commands actually piggy back on the sorted set datatype. Redis has several commands related to geospatial indexing (GEO commands) but unlike other commands these commands lack their own data type. By using geospatial indexing, these applications can quickly query and analyze data based on their location, without having to scan through large amounts of data to find the relevant information. ![]() Geospatial indexing is particularly useful in applications that deal with large volumes of geographic data, such as mapping applications, geolocation services, and spatial analytics. It involves indexing the spatial data in a database using a specialized data structure that can quickly identify which objects or data points are located within a particular geographic region. Geospatial indexing is a technique used in databases to efficiently store and retrieve data based on their geographic location. Back to Glossary Geospatial Indexing Defined
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |