像0101000020E610000098E9F4A131405C40BBA1265A25B53740
这种编码过后的经纬度,是怎么计算的。尝试过去看postgis和mongodb的源码,无奈没找到(不懂啊……)
漂亮男人2017-04-24 16:02:26
I don’t know much about PostGIS, but the principle should be the same.
In MongoDB, let’s discuss 2d index first. Chinese documents are all translated!
http://docs.mongoing.com/manual-zh/core/geospatial-indexes.html
In MongoDB, 2d index can be used to index a point. We divide a square into 4 equal parts, numbered 00, 01, 10, 11, and then divide the small square containing the target point in the same way. After 32 times, we get a numbered sequence, which we can put together. Geohash has some good properties. For example, if the large square divided according to the above aspects contains a small square, the Geohash of the former is the prefix of the latter. Detailed information is available on Wikipedia.
For 2dsphere index, MongoDB uses S2 library to do Geohash, see slides on Google Doc.
Also, why do you want to know about Geohash? Is it necessary to understand what problems you encounter?