kungfoo / geohash-java

Implementation of GeoHashes in java. We try to be/stay compliant to the spec, as far as possible.
Other
981 stars 310 forks source link

Terminology explanation and getting started with geohash #27

Closed ihsanhaikalz closed 7 years ago

ihsanhaikalz commented 7 years ago

I am interested to know more about geohash but I tried to learn from the test classes it is quite hard to understand for me. Could you tell me how can I get start with geohash?

Also could you tell me what does adjacent and precision mean? I found 22 bit precision and true adjacent but can't work out what does it mean?

kungfoo commented 7 years ago

You best start here: https://en.wikipedia.org/wiki/Geohash The library is an implementation of this http://geohash.org/

A geohash is not a point, but rather a bounding box defined by subdividing a coordinate system in terms of it's axes. Two of those bounding boxes are adjacent, if they are next to each other in at least one dimension (for WGS84-coordinates, there is two latitude and longitude).

Precision is actually the size of the bounding box. Less precision means a larger bounding box. The point is (no pun intended) that the prefix of a larger bounding box, that contains another smaller bounding box is the same, so you can check contains() by looking at the prefixes of the hashes.