geohash string length and accuracy

后端 未结 5 531
挽巷
挽巷 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:42

    Here is an equation (in pseudocode) that can approximate the optimal Geohash length for a latitude/longitude pair having a certain precision:

    geohash_length = FLOOR ( LOG_2(5000000/precision_in_meters) / 2,5 + 1 )
    if geohash_length > 12 then geohash_length = 12
    if geohash_length < 1 then geohash_length = 1
    

    I've used it to create the optimal Geohash from data received by the gpsddaemon, which also provide precision information via the epx and epy values.

提交回复
热议问题