VAStGoodies.com
Your VA Smalltalk OSS repository. Powered by VA Smalltalk with Seaside.

Geohash

Having multiple geolocations of point of interests (POI) it can be hard to do a nearby search.
For performance reason you don't want to calculate the distance between each poi and the users location.
Therefore you can use the geohash (https://en.wikipedia.org/wiki/Geohash).
This hash describes a rectangle, where the hash becomes longer, the smaller the rectangle becomes.
So you can store each poi with the geohash in a database and then query it performantly

Example of usage:
First you need to get the geolocation of the user.
Then get the distance where to search in.
After that get the needed length of the hash. And gernerate the has of the users location.
Because the location could be on the side of the described bounding-box of the hash, you have to get the neighbours (8 additional hashes).
Now you could do a databaseloockup with these 9 hashes.
To fasten the things up, you can reduce the number of requests and search with ranges. You will end up in mostly 3-5 ranges of hashes, so you only have to do 3-5 queries instead of 9.

You can see an example in SimGeohashTestCase>>#testFullSearch
Licence:
Free for commercial and noncommercial purposes. You do not need to ask permission from or provide credit to the author, although it is appreciated.
Email:simon.franz85@gmail.com
Developers:Simon Franz
Tags:geohash geolocation gps
Configuration Maps:SimGeohash (1↑|34↓)
Number of uploads:1
Number of downloads:34