ArticleslgStudy

science

Geohash

Geohash is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Geohash rather than just read about it. In short: Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer which encodes a geographic location into a short string of letters and digits. Similar ideas were introduced by G.M.

Geohash — main illustration
Geohash — illustration

Key takeaways

  • Geohash belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Geohash to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Geohash from memory before moving on to harder problems.

Reference excerpt

Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer which encodes a geographic location into a short string of letters and digits. Similar ideas were introduced by G.M. Morton in 1966. It is a hierarchical spatial data structure which subdivides space into buckets of grid shape, which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves. 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). Geohashing guarantees that the longer a shared prefix between two geohashes is, the spatially closer they are together. The reverse of this is not guaranteed, as two points can be very close but have a short or no shared prefix.

History The core part of the Geohash algorithm and the first initiative to similar solution was documented in a report of G.M. Morton in 1966, "A Computer Oriented Geodetic Data Base and a New Technique in File Sequencing". The Morton work was used for efficient implementations of Z-order curve, like in this modern (2014) Geohash-integer version (based on directly interleaving 64-bit integers), but his geocode proposal was not human-readable and was not popular. Apparently, in the late 2000s, G. Niemeyer still didn't know about Morton's work, and reinvented it, adding the use of base32 representation. In February 2008, together with the announcement of the system, he launched the website geohash.org, which allows users to convert geographic coordinates to short URLs which uniquely identify positions on the Earth, so that referencing them in emails, forums, and websites is more convenient. Many variations have been developed, including OpenStreetMap's short link (using base64 instead of base32) in 2009, the 64-bit Geohash in 2014, the exotic Hilbert-Geohash in 2016, and others.

Typical and main usages To obtain the Geohash, the user provides an address to be geocoded, or latitude and longitude coordinates, in a single input box (most commonly used formats for latitude and longitude pairs are accepted), and performs the request. Besides showing the latitude and longitude corresponding to the given Geohash, users who navigate to a Geohash at geohash.org are also presented with an embedded map, and may download a GPX file, or transfer the waypoint directly to certain GPS receivers. Links are also provided to external sites that may provide further details around the specified location. For example, the coordinate pair 57.64911,10.40744 (near the tip of the peninsula of Jutland, Denmark) produces a slightly shorter hash of u4pruydqqvj. The main usages of Geohashes are:

As a unique identifier. To represent point data, e.g. in databases. Geohashes have also been proposed to be used for geotagging. When used in a database, the structure of geohashed data has two advantages. First, data indexed by geohash will have all points for a given rectangular area in contiguous slices (the number of slices depends on the precision required and the presence of geohash "fault lines"). This is especially useful in database systems where queries on a single index are much easier or faster than multiple-index queries. Second, this index structure can be used for a quick-and-dirty proximity search: the closest points are often among the closest geohashes.

Technical description A formal description for computational and mathematical views.

Textual representation For exact latitude and longitude translations Geohash is a spatial index of base 4, because it transforms the continuous latitude and longitude space coordinates into a hierarchical discrete grid, using a recurrent four-partition of the space. To be a compact code it uses base 32 and represents its values by the following alphabet, that is the "standard textual representation".

The "Geohash alphabet" (32ghs) uses all digits 0-9 and all lower case letters except "a", "i", "l" and "o". For example, using the table above and the constant B = 32 {\displaystyle B=32} , the Geohash ezs42 can be converted to a decimal representation by ordinary positional notation:

[ezs42]32ghs = [ ( e × B 4 ) + ( z × B 3 ) + ( s × B 2 ) + ( 4 × B 1 ) + ( 2 × B 0 ) ] 32 g h s {\displaystyle [(e\times B^{4})+(z\times B^{3})+(s\times B^{2})+(4\times B^{1})+(2\times B^{0})]_{32ghs}}

= [ e ] 32 g h s × B 4 + [ z ] 32 g h s × B 3 + [ s ] 32 g h s × B 2 + [ 4 ] 32 g h s × B 1 + [ 2 ] 32 g h s × B 0 {\displaystyle [e]_{32ghs}\times B^{4}+[z]_{32ghs}\times B^{3}+[s]_{32ghs}\times B^{2}+[4]_{32ghs}\times B^{1}+[2]_{32ghs}\times B^{0}}

… excerpt ends here. Continue reading the full article.

Illustrations

Geohash: The 6g[1] cell and its sub-grid.
The 6g[1] cell and its sub-grid.
Geohash illustration
Geohash: The curve of the grid of 32 cells was obtained merging 2 by 2 cells of the "next level" (64 cells grid illustrated here) to obtain a geometrical representation of the "odd-digit Geohash".
The curve of the grid of 32 cells was obtained merging 2 by 2 cells of the "next level" (64 cells grid illustrated here) to obtain a geometrical representation of the "odd-digit Geohash".
Geohash: It is possible to use same base32-Geohash codes in different indexing curves. For quadrilateral tiling the Hilbert curve is the best alternative for Morton curve, used for example in the S2-geometry. Codes with even number of digits (2, 4, ...) are mapped to regular grids, but codes of odd number (1, 3, ...) must be mapped to an irregular intermediary grid, with cells indexed by degenerated curves.
It is possible to use same base32-Geohash codes in different indexing curves. For quadrilateral tiling the Hilbert curve is the best alternative for Morton curve, used for example in the S2-geometry. Codes with even number of digits (2, 4, ...) are mapped to regular grids, but codes of odd number (1, 3, ...) must be mapped to an irregular intermediary grid, with cells indexed by degenerated curves.

Worked examples

Example 1 — a first encounter with Geohash

Start with the simplest possible case. Write down what Geohash claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Geohash before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Geohash ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Geohash

In research
Geohash appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Geohash in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Geohash is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2008 introductions, Geocodes, Geographic coordinate systems, so understanding it makes those chapters shorter.
In everyday life
Look for Geohash outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Geohash in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Geohash means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Geohash out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Geohash in simple terms?

Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer which encodes a geographic location into a short string of letters and digits. Similar ideas were introduced by G.M.

Why does Geohash matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Geohash?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Geohash.

Tags

  • 2008 introductions
  • Geocodes
  • Geographic coordinate systems

Keep exploring