Geohashing为不同的哈希值返回相同的位置

时间:2016-03-19 21:33:48

标签: python geohashing

我在python中使用Geohash库。请考虑以下代码:

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Geohash
>>> Geohash.decode("u3qcr")
('52.3', '21.1')
>>> Geohash.decode("u3qcx")
('52.3', '21.1')

为什么我会针对不同的哈希得到相同的结果?我希望因为我们有不同的最后一个字母,我们会得到不同的矩形。我错过了什么?

1 个答案:

答案 0 :(得分:1)

在给定的精度范围内,两个哈希的坐标都相同。检查

>>> Geohash.decode_exactly("u3qcx")
(52.31689453125, 21.07177734375, 0.02197265625, 0.02197265625)
>>> Geohash.decode_exactly("u3qcr")
(52.27294921875, 21.07177734375, 0.02197265625, 0.02197265625)
>>> 

比较enter image description here如何计算Geohash.decode()中的舍入值。