Skip to main content

Properties of Geohash algorithm

·1 min
  • They seem to be a neat alternative to {longitude, latitude} combinations. So, if I encounter a problem that needs to deal with locations, I should think of this algorithm first.
    • Just one thing to store in a database compared to 2 if I use lat-long.
  • Depending on the lower bound on distance I need to track (for example, “I only care for 5 meters or bigger distances to determine Covid exposure”), I can determine the hash length to use.
    • Hash length is a confusing term but all it means is the string length for the encoded locations.
    • 12 is unnecessarily/too precise for many practical applications such as Covid exposure, cab booking, find-restaurants-near-me etc.
  • Hashes are a good key for partitioning if I want to ingest the data in a stream. Even on box boundaries, where adjacent boxes have completely different prefixes, I should still know the prefixes for the 8 adjacent boxes and can query for them separately if required.