skillfed

pygeohash

Python module for interacting with geohashes

pygeohash v3.3.1 3.1M downloads/30d#2,737 on PyPI177
Permissive license MIT Active released

What it is and what it does

PyGeoHash is a Python library for encoding geographic coordinates into geohash strings and decoding them back. It provides a clean API for working with geohashes—compact string representations of latitude/longitude pairs that enable spatial indexing and proximity operations. The library has zero runtime dependencies and works with the Python standard library alone, though it offers optional visualization support via matplotlib and folium.

The package handles core geohash operations: encoding coordinates at variable precision, decoding hashes back to lat/lng pairs, calculating approximate distances between geohashes in meters, finding adjacent geohashes in any direction, and computing bounding boxes. It was rewritten in version 3.0.0 with a C extension for performance and now supports Python 3.8 and later. The library is actively maintained and has been extensively tested against the reference implementation at geohash.org.

Use it for:

  • Build location-based services that need compact, sortable geographic identifiers for proximity queries
  • Implement spatial indexing for large geographic datasets to enable fast neighbor lookups
  • Encode user locations with privacy in mind by storing lower-precision geohashes instead of exact coordinates
  • Cluster geographic data by grouping points that share common geohash prefixes
  • Visualize geographic regions and geohash grids on static maps or interactive Folium maps

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Encodes latitude/longitude coordinates to geohash strings and decodes them back, with utilities for distance calculations, adjacent geohash lookup, and optional visualization.

Yes. PyGeoHash is a lightweight, actively maintained library with zero runtime dependencies, a permissive MIT license, and no known vulnerabilities. Install friction is medium due to compiled wheels, but that is offset by clean API, broad platform support, and strong test coverage. Use it if you need reliable geohash encoding/decoding or spatial indexing for location-based applications.

Install

pygeohash on PyPI

pip

pip install pygeohash

uv

uv add pygeohash

poetry

poetry add pygeohash

Installing pygeohash

Before you install

Medium install friction due to compiled wheels for multiple Python versions and platforms, but no runtime dependencies. Active maintenance with a recent release 28 days ago.

License in practice

MIT license (permissive) allows use in commercial and proprietary projects with minimal restrictions; prior versions before 3.0.0 used GPL-3.0.

Quickstart

pip install pygeohash

import pygeohash as pgh

# Encode coordinates to geohash
geohash = pgh.encode(latitude=42.6, longitude=-5.6)
print(geohash)  # 'ezs42e44yx96'

# Decode geohash back to coordinates
lat, lng = pgh.decode(geohash='ezs42')
print(lat, lng)

Verify before relying

  • Whether the visualization features (matplotlib, folium) are truly optional or create hard dependencies when imported
  • Performance characteristics of the C extension relative to pure-Python alternatives in production workloads
  • Precision and accuracy guarantees for edge cases (poles, date line, extreme latitudes)

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 28 days since the last release
Last repo commit
First released
Downloads 3,133,497/month — #2,737 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pygeohash-3.3.1-cp310-cp310-macosx_10_9_x86_64.whl; pygeohash-3.3.1-cp310-cp310-macosx_11_0_arm64.whl; pygeohash-3.3.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; pygeohash-3.3.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pygeohash-3.3.1-cp310-cp310-win32.whl; pygeohash-3.3.1-cp310-cp310-win_amd64.whl; pygeohash-3.3.1-cp311-cp311-macosx_10_9_x86_64.whl; pygeohash-3.3.1-cp311-cp311-macosx_11_0_arm64.whl; pygeohash-3.3.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; pygeohash-3.3.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pygeohash-3.3.1-cp311-cp311-win32.whl; pygeohash-3.3.1-cp311-cp311-win_amd64.whl; pygeohash-3.3.1-cp312-cp312-macosx_10_13_x86_64.whl; pygeohash-3.3.1-cp312-cp312-macosx_11_0_arm64.whl; pygeohash-3.3.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; pygeohash-3.3.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; pygeohash-3.3.1-cp312-cp312-win32.whl; pygeohash-3.3.1-cp312-cp312-win_amd64.whl; pygeohash-3.3.1-cp313-cp313-macosx_10_13_x86_64.whl; pygeohash-3.3.1-cp313-cp313-macosx_11_0_arm64.whl

Keywords: geohash, gis

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Typing :: Typed

Tags

geohash encoding decodinglatitude longitude to geohashspatial indexing geohashproximity search geohashgeographic coordinates compressionlocation-based servicesgeohash distance calculation
geospatialspatial-indexinglocation-services

More Scientific/Engineering packages