Geohash Encoder and Decoder with Neighbours

Turn coordinates into geohash strings and back, check the cell size at your latitude, find neighbours for proximity search and cover an area with prefixes.

Berjalan dalam pelayar anda. Fail anda tidak pernah meninggalkan peranti. Lihat cara menyemaknya

…

Cara melakukannya

  1. 1
    Enter coordinates

    Type latitude and longitude, tap the map, or use your device location.

  2. 2
    Choose the precision

    Move the slider and watch the cell width and height change.

  3. 3
    Copy or decode

    Copy the geohash, or paste one into the decode box to see its box.

  4. 4
    Check neighbours

    Read the 3 by 3 grid and tap a cell to move there.

  5. 5
    Convert a list

    Use the bulk tab for CSV input and download the results.

  6. 6
    Cover an area

    Enter a bounding box in the cover tab and copy the list of cells.

Tentang alat ini

A geohash packs a latitude and longitude into a short string such as gcpuvpk, built from a 32-character alphabet that leaves out a, i, l and o. Every extra character splits the cell into 32 smaller ones, so a longer hash means a more precise location, and two places that share a prefix are usually close together. That property makes geohashes popular as database keys: Elasticsearch, Redis, DynamoDB designs and many mobile apps use them to find nearby things with a simple prefix query instead of a spatial index. This tool encodes coordinates at any precision from 1 to 12 characters, decodes a hash back to its centre and bounding box, draws the cell and its eight neighbours on an offline world map, measures the distance to another hash, converts whole CSV files, and lists the set of cells needed to cover a rectangle.

How encoding works

The algorithm alternates between longitude and latitude. It starts with the full range of -180 to 180 degrees for longitude and asks whether the point lies in the upper or lower half: upper gives a 1 bit, lower a 0 bit, and the range is halved. Then it does the same for latitude between -90 and 90. After five bits it looks up one character in the base-32 alphabet and carries on. Because longitude gets the first bit, odd-length hashes have one more longitude bit than latitude bits, which keeps cells roughly square at the equator, while even-length hashes produce cells about twice as wide as tall.

Neighbours and the edge problem

Two points one metre apart can have completely different hashes if a cell border runs between them, and at the 180th meridian the prefixes change completely. A proximity search therefore never relies on one prefix alone: it queries the cell that contains the point plus its eight neighbours. The neighbour grid in this tool is computed by stepping one cell width or height from the centre, wrapping across the date line, and showing an empty slot where a step would cross a pole. Tap any neighbour to move there.

Bulk, cover and table tabs

The bulk tab reads lines of latitude and longitude separated by commas, semicolons or tabs, or lines that contain a geohash, and returns a CSV with both forms. A header line is skipped. The cover tab takes a bounding box and lists every cell of the chosen precision that touches it, capped at 1,500 cells, which you can use as prefix filters. The precision table shows the real cell size in metres at your latitude, because cells narrow as meridians converge towards the poles.

The map

The map is drawn from Natural Earth land outlines bundled with the site, so it works offline and sends no requests to a tile server. Drag to pan, use the zoom buttons or the mouse wheel, and tap to place the point. Coastlines are coarse below city scale; the cells and coordinates are exact.

Limits

A geohash is not a measure of accuracy: precision 12 describes a cell a few centimetres wide, but your GPS reading is not that good. Cells are not equal in area, and distance between hash centres is not the same as distance between the original points. The tool does not do polygon covers or geohash-based clustering, and it is not meant for navigation.

Contoh berselesaian

Buckingham Palace sits at latitude 51.50135 and longitude -0.14189. At precision 7 it encodes to gcpuuz8. The cell spans 0.00137 degrees in both directions, which is 153 m north to south but only about 95 m east to west at that latitude because of the cos(51.5°) factor. Decoding gcpuuz8 gives a centre of 51.5018, -0.1421 with an error of ±0.0007 degrees, so the palace lies inside the box but not at its centre. Its east neighbour is gcpuuz9 and its north neighbour gcpuuzb, and the nine cells together cover roughly 285 m by 460 m, which is a sensible search area for a "shops within 200 m" query.

Ringkasnya

Soalan lazim

How many characters should my geohash have?

Match the cell to the search radius. Precision 5 is about 4.9 km, 6 about 1.2 km by 0.6 km, 7 about 150 m, 8 about 38 m by 19 m and 9 about 5 m. The table tab shows exact sizes for your latitude.

Why do two nearby points have different geohashes?

They sit on opposite sides of a cell border. Always search the cell and its eight neighbours, or use the cover tab for a box.

Is decoding exact?

Decoding returns the centre of the cell and its error bounds. The original point could be anywhere inside the box, so the decoded value is rounded to the digits the cell supports.

Which letters are not used?

The alphabet is 0-9 and b-z without a, i, l and o, to avoid confusion with digits. Input is case-insensitive.

Can I convert a spreadsheet?

Yes. Export it as CSV with latitude and longitude columns first, paste or open it in the bulk tab, and download the result as CSV.

Is my location sent anywhere?

No. All maths runs in the page and the basemap is a local file. The Use my location button asks the browser for permission and the coordinates stay on your device.

Percuma sepenuhnyaTiada bayaran, tiada pendaftaran
Fail kekal peribadiSemuanya berjalan dalam pelayar anda
Mudah dalam bahasa andaTersedia dalam banyak bahasa