在 Redis 中存储地理空间数据的方法 [英] Approaches to storing geospatial data in Redis
问题描述
我有一个 MySQL 表,其中包含大约 100 万个纬度和经度,每行都有一个主键值.
I've got a MySQL table consisting of roughly 1 million latitudes and longitudes with a primary key value for each row.
我想通过 Geohashing 或经纬度排序集将此表迁移到 Redis.
I'd like to migrate this table into Redis either through Geohashing or lat and lon sorted sets.
有人做过吗?以及您用于存储和查询数据的方法是什么(例如:在 Google 地图的纬度/经度范围内查询数据).
Has anyone done this? And what was the approach you used for storing and querying data (e.g.: querying data within a lat / lon range for Google Maps).
推荐答案
是的,已经完成了(使用 geohashing ...)
Yes, it has already been done (using geohashing ...)
例如,您可以检查 Geodis 包背后的数据结构(来自 Dvir Volk 和朋友):
You can check for instance the data structure behind the Geodis package (from Dvir Volk and friends):
https://github.com/doat/geodis
Redis 邮件列表上有一些关于它的讨论:
There were some discussions about it on the Redis mailing-list:
https://groups.google.com/d/topic/redis-db/Mw0lRzutnkE/讨论https://groups.google.com/d/topic/redis-db/6M-aAPA-iXc/讨论https://groups.google.com/d/topic/redis-db/Bps95jeRgr8/讨论
这篇关于在 Redis 中存储地理空间数据的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!