Registry / data / python-geohash

python-geohash

JSON →
library0.9.2pypypi✓ verified 25d ago

This is a legacy version (0.8.5) of a Python library for fast and accurate geohashing, providing functions to encode and decode geohashes to and from latitude/longitude coordinates. It originated from a Google Code project and was last updated in 2014. For actively maintained geohashing functionality, consider the 'pygeohash' library.

pip install python-geohash
INSTALL
IMPORT
SIG · PYTHON-GEOHASH
P
python-geohash
datapythonv0.9.2
Install
1.5s avg
Import
Disk
17MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

encode
from geohash import encode
import geohash; geohash.encode(lat, lng)
decode
from geohash import decode
bbox
from geohash import bbox

This quickstart demonstrates how to encode latitude and longitude coordinates into geohash strings, control the precision, and decode geohash strings back into coordinates using the `geohash` module. It also shows the usage of `uint64` representation for integer-based geohashing.

import geohash # Encode coordinates to a geohash string with default precision (12 characters) latitude, longitude = 42.6, -5.6 geohash_string = geohash.encode(latitude, longitude) print(f"Encoded geohash: {geohash_string}") # Encode with custom precision short_geohash = geohash.encode(latitude, longitude, precision=5) print(f"Short geohash (precision 5): {short_geohash}") # Decode a geohash string back to coordinates decoded_lat, decoded_lng = geohash.decode(geohash_string) print(f"Decoded coordinates: ({decoded_lat}, {decoded_lng})") # Example with uint64 representation uint64_hash = geohash.encode_uint64(latitude, longitude) print(f"Encoded uint64 geohash: {uint64_hash}") decoded_lat_uint64, decoded_lng_uint64 = geohash.decode_uint64(uint64_hash) print(f"Decoded uint64 coordinates: ({decoded_lat_uint64}, {decoded_lng_uint64})")
Debug
Known issues
breakingThis library (python-geohash 0.8.5) is largely unmaintained since its last update in 2014. Users are strongly advised to consider more actively developed and modern alternatives like the 'pygeohash' library (lowercase 'p' in package name) for current projects, which offers Python 3 support, zero dependencies, and performance optimizations.
fix
Migrate to a maintained library such as `pygeohash` (`pip install pygeohash`).
affects: 0.8.5 and older
gotchaInstallation issues with the optional C extension are common on modern operating systems (e.g., macOS with newer Python versions), potentially leading to `command 'g++' failed with exit status 1` errors during `pip install`. The library can fall back to a pure Python implementation, but this might result in a silent performance degradation or complete installation failure.
fix
Ensure a C/C++ compiler is installed and properly configured, or consider using the pure Python fallback if the C extension fails to build (though this library's pure Python mode might still be slow compared to modern alternatives). Migrating to `pygeohash` (which has its own optimized CPython core) is the recommended solution.
affects: 0.8.5
gotchaThe `decode()` function returns raw float values for latitude and longitude. Some other geohash libraries might return a tuple with error margins or a custom object, which could lead to incompatibility if migrating between libraries or expecting a specific structured output.
fix
Adjust code to handle the direct float return values. If migrating, review the decoding output format of the new library carefully.
affects: 0.8.5
gotchaGeohashes, by nature, can sometimes represent geographically close points with different prefixes if they fall on opposite sides of a geohash grid boundary. This can affect proximity search logic based solely on prefix matching.
fix
For precise proximity searches, supplement geohash prefix matching with bounding box queries or actual distance calculations for candidate geohashes, rather than relying solely on shared prefixes.
affects: All versions (inherent to Geohash algorithm)
Upgrade
Version history
0.9.2latest on PyPI · released Jun 2, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
python-geohash — pip install python-geohash · libregistry