postgresql - MongoDB和PostGIS的Geohash是怎么计算的?
某草草
某草草 2017-04-24 16:00:26
0
1
851

0101000020E610000098E9F4A131405C40BBA1265A25B53740这种编码过后的经纬度,是怎么计算的。尝试过去看postgis和mongodb的源码,无奈没找到(不懂啊……)

某草草
某草草

Antworte allen(1)
漂亮男人

PostGIS的不太了解,不过原理应该是一样的。

在 MongoDB 里,我们先讨论 2d index,中文文档都有翻译的!
http://docs.mongoing.com/manual-zh/core/geospatial-indexes.html

MongoDB里,2d index 可以用来索引一个点。我们把一个正方形均分成4份,编号00,01,10,11,然后再对包含目标点的小的正方形同样划分,32次之后,得到一个编号的序列,拼起来就是了。Geohash 有一些很好的性质,比如如果按照以上方面所划分得到的大正方形如果包含小正方形的话,则前者的Geohash是后者的前缀。Wikipedia 上有详细介绍。

对 2dsphere index,MongoDB 使用 S2 library 来做 Geohash, 参见 Google Doc 上的 slides.

另外,为什么想了解 Geohash 呢?遇到什么问题必须要理解它么?

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!