Geohash is a latitude/longitude geocode system (public domain). It is a hierarchical spatial data structure which subdivides space into buckets of grid shape.
Geohashes offer properties like arbitrary precision and the possibility of gradually removing characters from the end of the code to reduce its size (and gradually lose precision).
As a consequence of the gradual precision degradation, nearby places will often (but not always) present similar prefixes. The longer a shared prefix is, the closer the two places are.
http://en.wikipedia.org/wiki/Geohash
https://github.com/sharonjl/geohash-net
https://github.com/simplegeo/libgeohash/blob/master/geohash.c