How are the Geohash of MongoDB and PostGIS calculated?

  mongodb, question

Like0101000020E610000098E9F4A131405C40BBA1265A25B53740How are the longitude and latitude after this encoding calculated? I tried to look at the source code of postgis and mongodb in the past, but I couldn’t find it (I don’t understand …)

Let’s assume another point a and a bunch of points b1,b2,b3,…..bn in the database.
How is it sorted?

PostGIS doesn’t know much about it, but the principle should be the same.

In MongoDB, let’s first discuss 2d index. Chinese documents are 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 parts, numbered 00,01,10,11, and then divide the small square containing the target points into the same parts. After 32 times, we get a numbered sequence and put it together. Geohash has some good properties, for example, if the large square divided according to the above aspects contains small squares, the former’s Geohash is the prefix of the latter. Wikipedia has a detailed introduction.

For 2dsphere index, MongoDB uses S2 library to do Geohash, seeSlides on Google Doc.

Besides, why do you want to know about Geohash? Do you have to understand it when you encounter any problems?