The A-Z of Geohashing: What You Need to Know

One major strength of Geohashing is that it can also be used to provide a good degree of anonymity, meaning that the user is given the necessary level of confidentiality regarding their exact location.

Geohashing is a geocoding technique designed to encode geographic locations into a short web of letters and digits. The technique was invented in 2008 by Gustavo Niemeyer.

This geocoding technique is a spatial data structure that subdivides space into buckets in a grid enabling you to pinpoint which area on a map a user is situated.

One major strength of Geohashing is that it can also be used to give a good degree of anonymity providing the user with the necessary level of confidentiality regarding their exact location. The length of the Geohash, on the other hand, offers more insight into their location within an area.

How Geohashing Works

Geohashes employ Base-32 alphabet encoding. This means characters can be 0-9 and A-Z excluding the letters “A”, “I”, “L” and “O”.

The very first character in a Geohash identifies the prior location as one of the 32 cells. This cell also contains 32 cells and the pattern replicates itself. Conversely, adding more characters subdivides a cell effectively zooming into a more defined area.

The precision factor is key to determining how small or big the size of a cell will be.

A geohash showing where a user is in a wider area.
A Geohash showing where a user is in a wider area. Image Source {Pub Nub}

The size of the field can be altered by specifying the number of characters in the hash from 1 to 10.

Key properties of Geohashing include arbitrary precision and the ability to gradually expunge letters to reduce their size, which leads to loss of precision.

As a result of the gradual erosion of precision, nearby areas will most of the time denote similar prefixes. Consequently, the longer a shared prefix is, the nearer the two places are.

A Geohash can also be used to signify when two users are close to each other. As illustrated by the example below, two users are both represented by a 9 digit Geohash. Nine digits are very accurate as they notify you that the user is stationed somewhere within 16 feet or 4.87 metres.

Geohashes of 2 users in close proximity.
A Geohash capturing the location details of two users in close proximity. Image Source {Will Hill via Medium. Com}

The image below shows that the two users are both in the area marked as “9q8”. The distinction is that one is in “9q8y” while the other is in “9q8z”

2 Geohash cells starting with "9q8" have contrasting locations due to the difference in the 4th character.
A Geohash contrasting the locations of two users within one larger area. The difference in the 4th character indicates that they’re so far apart that you cannot even see the other user’s Geohash cell. Image Source {Will Hill via Medium. Com}

History of the Geohash

Gustavo Niemeyer’s invention of the Geohash borrows several key aspects from G.M Morton’s work documented in 1966 in a report dubbed A Computer Oriented Geodetic Data Base and a New Technique in File Sequencing. G.M Morton is credited with coming up with the first initiative that has over the years culminated into the present-day Geohash.

To put this into perspective, Morton’s work was incorporated in the implementation of the modern (2014) Geohash-integer version whose concept hinges on directly interleaving 64-bit integers. However, Morton’s work did not have the impact it would have otherwise had because it was not human-readable.

Gustavo Niemeyer reportedly did not learn of Morton’s work until the late 2000s when he studied it, reinvented it and repurposed it to suit present-day challenges. Niemeyer achieved this by adding the base-32 representation.

In what would mark a milestone for him and Geohash as a discipline, Niemeyer in February 2008 announced the system and launched the geohash.org website.

The website allows users to convert geographic coordinates into short URLs which distinctively allow users to pinpoint positions on the earth. This makes it easier to reference them on websites, emails and forums.

The Geohash Methodology

In order to acquire the Geohash, the user has to provide an address or coordinates they would like geocoded in a single input box after which they proceed and perform the request.

Geohash.org input box
The geohash.org home page. The site contains an input box where users can key in coordinates they would like geocoded. Image Source {geohash.org}

Besides showing the coordinates that align with the given Geohash, users who navigate to a Geohash via Niemeyer’s website (geohash.org) are furnished with an embedded map and have the option of downloading a GPX file (GPS Exchange formatted file) or transfer the waypoint directly to specific GPS receivers.

Geohash.org's embedded map with the GPX download option
A screenshot of a browser redirected directly to the GPX download page. Image Source {geohash.org}

Users are also presented with external sites that may provide them with more information regarding the location in question.

Experts in this field have also mooted the idea of using Geohashes for geotagging.

The structure of Geohashed data has two main advantages when used in a database.

One is that data indexed by a Geohash will be inclusive of all points for a given rectangular region in continuous slices. The number of these slices hinges on the desired precision and the presence of Geohash “fault lines”.

Secondly, this index structure can be applied for a quick proximity search. In this scenario, the closest points are usually among the closest Geohashes.

Use Cases of Geohashes

Initially, Geohashing was first developed as a URL-shortening service but it has since evolved and is now commonly used for digital travelling, proximity searches, social networking and the development of interactive apps.

Digital Travels

Geohashes can be used for digital global expeditions to meet new people and discover new places. Some of the apps used for this purpose include Driftr, Bonjournal, Day One Journal and Travel Diaries.

Proximity Searches

People use Geohashes to locate places of interest, social amenities, buildings, schools, restaurants and so on. Ridesharing apps (Uber, Bolt, Little and Grab), delivery apps (Glovo, Deliveroo, TheFork and Foodpanda) and check-in apps (Foursquare, Eventbrite and Citymapper) fit into this bracket.

Social Networking

Geohashes can be used to find dating matches within a particular region and to set up group chats that bring people with similar interests together. Some of the apps in this use case include Tinder, Bumble, OkCupid, Match.com and Grindr.

Interactive Apps

Geohashing can also be deployed to create real-time interactive apps. News list interaction apps (Scooper News and PressReader) and Interactive Animation apps (Anine Tok 3D, TweenCraft and KisomoApp) fall under this banner.

Limitations of Geohashes when Deployed to Decide Proximity

Edge Cases

Geohashes can be deployed to track points based on closeness to each other using a common prefix.

However, in the edge case scenario, locations in close proximity to each other but on different sides of the 180-degree meridian will culminate into Geohash codes without a common prefix. This will lead to different longitudes for near physical locations.

Whereas, points near the North and South poles will bear very different Geohashes. This will also lead to different longitudes for near physical locations.

Non-Linearity

As a consequence of a Geohash in this instance being based on coordinates of longitude and latitude, the distance between two Geohashes manifests itself in longitude/latitude coordinates which is not tantamount to actual distance.

Different spatial solutions for the same scale.
Different spatial solutions are produced by varying the length of the Geohash at the same scale: Left seven characters, middle six characters, right five characters. Image Source: {ResearchGate}

These limitations can neither be attributed to Geohashing nor latitude-longitude coordinates, but due to how laborious it is to map coordinates on a sphere to two-dimensional coordinates, in addition to the difficult nature of exploring a two-dimensional space homogenously.

The first is linked to Map Projection and Geographical Coordinate System while the other is linked to the z-order curve and the Hilbert Curve.

As soon as a coordinate system that denotes points linearly in distance and terminates at the edges can be explored homogenously, applying Geohashing will not experience the above-mentioned limitations.

Geohashing Versus Open Location Code (OLC)

There are other geo-coding techniques employed by different users across different professional spheres. One notable technique is the Open Location Code (OLC).

Open Location Code (OLC) is a geo-coding technique for identifying a specific area on earth.

Alternatively, OLC can be defined as a geocode method for establishing any area on the surface of the earth. OLC premiered in October 2014 after being created and successfully tested by Google’s Zurich engineering office.

OLC is tailored to be used as a street address and is especially useful in places that do not have formal systems to identify street names, buildings, postcodes and house numbers.

Conversely, location codes generated by OLC are known as plus codes. Plus codes are obtained from longitude and latitude coordinates hence they exist everywhere. They resemble telephone numbers in length.

For instance, 87G8Q257+5QP is the 10 character plus code for Times Square, New York.

It is possible for these codes to be shortened to only four or six digits when coupled together with the locality (Q257+5QP).

Plus codes bring to the table many of the advantages that Geohashes do, but one downside is they can only manifest geographic coordinates and cannot define the discrete spots held by those coordinates and differentiate between them.

Times Square's OLC on Google Maps
The Open Location Code For Times Square, New York. Image Source {Google Maps}

Advantages of Geohashing over OLCs in Online Hyperlocal Advertising

Scalability

Geohashes are more scalable in geotagging an area compared to OLCs which are more suited to street addresses as opposed to geofencing purposes.

Flexibility

Geohash provides more wiggle room for flexibility while configuring the radius for creating a geofence as compared to OLCs. The difference in the area covered by OLCs between two code lengths succeeding each other is much greater compared to a Geohash.

Smaller code length

A smaller code length suffices to cover the same geographical area in a Geohash as compared to OLCs. Confusion is also avoided in using a plus code for geotagging a location hence making it easier to fetch and store in Geohashes as compared to OLCs.

Accuracy

When it comes to data provided by different ad serving platforms, the maximum length a Geohash can have is 8 characters. OLCs on the other hand can have a maximum length of 275 metres which might lead to distortion of accuracy while configuring sections that might need precise targeting (usually up to 50 metres).

Work Celebrated Decades Later

Without G M Morton’s work, Gustavo Niemeyer’s invention would not be as advanced as it is now. In 1966, Morton’s work was not human-readable meaning that its potential was not realised until decades later.

Stumbling on Morton’s work and studying it was a step in the right direction for Niemeyer and the other technology experts who have used his work to solve problems.

What was not human-readable then is now a recipe for finding solutions for present-day challenges.

Those challenges include finding the right partners in dating apps, exploring the world digitally, finding buildings, events and amenities in close proximity to us and developing apps where all invested parties get to communicate and exchange ideas.

The legend lives on.