sweeney + geohash   3

davetroy/geohash-js - GitHub
38.897, -77.036 Using the geohash algorithm, this latitude and longitude is converted to: dqcjqcp84c6e A simple bounding box around this point could be described by truncating this geohash to: dqcjqc However, 'dqcjqcp84c6e' is not centered inside 'dqcjqc', and searching within 'dqcjqc' may miss some desired targets. So instead, we can use the mathematical properties of the Geohash to quickly calculate the neighbors of 'dqcjqc'; we find that they are: 'dqcjqf','dqcjqb','dqcjr1','dqcjq9','dqcjqd','dqcjr4','dqcjr0','dqcjq8' This gives us a bounding box around 'dqcjqcp84c6e' roughly 2km x 1.5km and allows for a database search on just 9 keys: SELECT * FROM table WHERE LEFT(geohash,6) IN ('dqcjqc', 'dqcjqf','dqcjqb','dqcjr1','dqcjq9','dqcjqd','dqcjr4','dqcjr0','dqcjq8'
geohash  js 
april 2011 by sweeney

Copy this bookmark:



description:


tags: