arjunmehta / node-georedis

Super fast geo queries.
MIT License
192 stars 33 forks source link

Question regarding algorithm in GIS SE #26

Closed winash12 closed 5 years ago

winash12 commented 6 years ago

https://gis.stackexchange.com/questions/18330/using-geohash-for-proximity-searches/228494#228494 I am trying to implement the algorithm in Python that you have published on the GIS SE site.

Here is where I am currently. I have the following box which is like this minLat, maxLat : 0.05 minLon,maxLon : 0.05

So my coordinate set is a grid with a grid spacing of 0.05 degrees. The boundaries of the grid are marked by minLat,maxLat,minLon,maxLon. In my case the data grid is a constant and will never change.

So for each grid coordinate(gridLat,gridLon) I encode using a geohash and calculate it's eight neighbors as well. For me the precision is 26 because my query window is 5 kms(query window will never change) Then I add one to the 9 members above. So I have 18 members in total. Since my data set is evenly distributed can I store these in a HashMap because the lookup can be of complexity O(1) ?

winash12 commented 6 years ago

The values of the 18 geohashes are not unique. Please see my discussion here - https://github.com/yinqiwen/geohash-int/issues/8#issuecomment-419440444

Adding one to geohash int does not produce 18 unique numbers. Therefore this approach cannot be used to do range queries.