geohash string length and accuracy

后端 未结 5 536
挽巷
挽巷 2020-12-12 23:03

if length of geohash string is more, it is more accurate. But is there any direct relationship like if length is 7 it is providing 100 meter accuracy,

i.e. if two

5条回答
  •  青春惊慌失措
    2020-12-12 23:30

    Also any directway to calculate distance between two geo-hash? (one way is to decode them to lat/lng, and then calculate distance)

    That is what you should do. Think of the geohash as just another representation of a latitude and longitude as a pair of printed decimal numbers are likewise. If I gave you a pair of lat & lon strings, you would parse them to numbers (in your programming language of choice), and then do the math. It's no different with geohashes -- decode to lat & lon then do the math.

    Be very careful with any reasoning you are attempting to do with inferring closeness based on the length of the common prefix between a pair of points. If there is a long common prefix, then they are close, but the converse is not true! -- i.e. two points with no common prefix could be a millimeter apart.

提交回复
热议问题