geohash string length and accuracy

后端 未结 5 537
挽巷
挽巷 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 are the formulas for height and width in degrees of a geohash of length n characters:

    First define this function:

        parity(n) = 0 if n is even otherwise 1

    Then

        height = 180 / 2(5n-parity(n))/2 degrees

        width = 180 / 2(5n+parity(n)-2)/2 degrees

    Note that this is the height and width in degrees only. To convert this to metres requires that you know where on the earth the hash is.

    Code for this in java is at http://github.com/davidmoten/geo.

提交回复
热议问题