Welcome to PyGeoHash’s Documentation!¶
PyGeoHash is a simple, lightweight, and dependency-free Python library for working with geohashes.
Key Features¶
Zero Dependencies: Works with just the Python standard library
Simple API: Clean, intuitive functions that are easy to understand
Lightweight: Minimal overhead for your projects
Python 3 Support: Fully compatible with modern Python
Robust Implementation: Reliable geohash operations
Visualization: Optional visualization capabilities with Matplotlib and Folium
Quick Start¶
Installation:
pip install pygeohash
Basic usage:
import pygeohash as pgh
# Encode coordinates to geohash
geohash = pgh.encode(latitude=42.6, longitude=-5.6)
print(geohash) # 'ezs42e44yx96'
# Decode geohash to coordinates
lat, lng = pgh.decode(geohash='ezs42')
print(lat, lng) # '42.6', '-5.6'
Visualization:
# Install with visualization support
pip install pygeohash[viz]
import pygeohash as pgh
from pygeohash.viz import plot_geohash
import matplotlib.pyplot as plt
# Plot a geohash
fig, ax = plot_geohash("9q8yyk", color="red", show_label=True)
plt.show()
