18

I would like to know the precision of a geohash with a given length. If there is a 'simple' formula you can use to calculate it, that would be extra-cool.

Wikipedia lists the precision up to 8 characters:

#   km
1   ±2500
2   ±630
3   ±78
4   ±20
5   ±2.4
6   ±0.61
7   ±0.076
8   ±0.019
  • What is it that you want to know? – Vince Sep 26 '14 at 12:21
  • The precision when having geohashes with 9, 10, 11.. characters – Gundon Sep 26 '14 at 12:29
  • 1
    When it comes to that, it's not so much about how decimals you have but how many that are relevant. See here for an answer to your question: gis.stackexchange.com/questions/8650/…, but pay attention to the difference between accuracy and precision. – Martin Sep 26 '14 at 12:40
  • The Wikipedia article on Geohash also states that "each subsequent bit halves [the] error." This isn't the km error (or even the decimal degree error), but rather the window/range of possible locations. – Erica Sep 26 '14 at 13:07
  • Thanks for mentioning that Erica. I did understand that, but maybe did not make myself clear enough. @Martin Geohashes are not the same thing as lat/long-coordinates, although they are derived from that.. I don't think that this question is a duplicate of the other. If it was: Can you tell me the km-window of a geohash with 9 characters? – Gundon Sep 26 '14 at 13:52
29
+100

so one symbol (letters or digits) is base 32 (8 bits) Each first bit is used for high or low window, then subsequent bits divide the precision by 2. (so divide by 8 in the best case) but there is an alternance between lat and long precision, so it ends up dividing by 4 and 8 alternatively.

#   km      
1   ± 2500
2   ± 630
3   ± 78
4   ± 20
5   ± 2.4
6   ± 0.61
7   ± 0.076
8   ± 0.019
9   ± 0.0024
10  ± 0.00060
11  ± 0.000074

Note that, as mentioned on the Wiki page, those values come from a location near the equator, where a degree has nearly the same lenght in X and Y. For a more accurate information, you should start from the lat and long errors, and compute the km precision along X-axis based on the latitude of your position.

  • I am in between writing another answer or a comment but here it goes. Answer is logically correct but numbers are plain wrong. One letter is not 32bit but it is in base 32, which is just 5 bits. One letter can be 8bit, assuming an ascii char but that doesn't have 256 visible characters which defies readability purpose of geohash. When you have base32 you can use a limited alphabet to represent 5bits. Since this is an odd number, with each letter you can get 3lat,2lon or 2lat,3long, what geohash does is also alternate so it is 3lat,2lon then 2lat,3lon so you get even distribution. – auselen Jan 20 '17 at 11:28
  • thanks for your comment. I will check and update my answer according to your comment. – radouxju Jan 20 '17 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.