--- id: pygeohash version: "3.3.1" license: MIT license_treatment: permissive maintenance: active --- # pygeohash — Python module for interacting with geohashes License: permissive · Maintenance: active · Downloads: 3.1M/mo ## 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 above — 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 pip install pygeohash uv add pygeohash 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_current - Install friction: medium - Maintenance: active - Downloads: 3.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags geohash encoding decoding, latitude longitude to geohash, spatial indexing geohash, proximity search geohash, geographic coordinates compression, location-based services, geohash distance calculation, geospatial, spatial-indexing, location-services [View on SkillFed](https://skillfed.io/packages/pygeohash) · [View on PyPI](https://pypi.org/project/pygeohash/)