Redis Geo:redis New Location query feature

Source: Internet
Author: User

Reproduced in: http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/144.html

The mobile internet has enhanced people-to-people connections, where location-based services (locations Based service,lbs) play an important role in promoting them. In the mobile Internet environment, each mobile phone has become a location tracking device, providing people with a very rich location services. Whether it is a nearby person, or shake a shake and other familiar applications need lbs in the background support. However, there are many challenges in the process of using location information, such as the inaccurate calculation of neighboring computations. The Redis Geo module is designed to provide accurate and stable location services due to the constant volume of data requests and the fact that the computing of the location services is done by the database.

In the challenge of location services, it is common to calculate whether two locations are adjacent to each other. Location information is composed of a four-tuple, (longitude, latitude, altitude, time), in the use of the process is more commonly used is latitude and longitude. A two-dimensional index is required to perform adjacent calculations. The problem is that the existing two-dimensional index based on simple one-dimensional index and range search implementation, basically only applies to integer query, and does not apply to the similarity query of latitude and longitude. Aware of this difficulty, and with the growing demand for location services, in 2008 Gustavo Niemeyer proposed a geohash, simply a 32-bit coded string to integrate the location into a range of entities that can be searched. Because most databases support scope queries, the location becomes available for lookup and computation. The disadvantage of the original Geohash is that the accuracy of the query is sometimes low, and subsequent developers create 52-bit geohash to meet the needs of customization.

In NoSQL, MongoDB has a better support for location services, and it supports Foursquare and other applications stably. HBase has also introduced tutorials to support the introduction of location services in the app. As a model for excellent NoSQL databases, Redis is slightly weaker in location computing. To this end, Italian programmer Salvatore Sanfilippo ([email protected]) maintains a branch specifically for Redis to add location calculations. After its release, it received a unanimous endorsement in the field, with up to 13,000 stars harvested in just a few months. In Hacker News, many programmers have also expressed the brief encounter of the function of Redis location query, we have discussed the necessity of the existence of Redis Geo, and some methods that should be improved from performance and query accuracy, and even contributed to the Redis Geo's Docker image.

More details on the Redis Geo can be found in the documentation page given by Antirez, which includes the basic use of Redis Geo, such as the addition of latitude and longitude, calculation of latitude and longitude, calculation of the inclusion relationship between cities, and many other location computing functions. Antirez further explains how Redis Geo works, and the performance of the module running on benchmark, up to nearly 5 million codecs per second, to meet the needs of most location service applications.

Redis Geo:redis New Location query feature

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.