Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

pygeohash

Latest version: v3.6.0

Overview

Last scanned
23 Nov 2026
Published
23 Nov 2026
PyPI package Publisher: willmcg4132
178 Stars
27 Forks
1 Versions
1.6M Downloads
Python Repo language

Scan summary

pygeohash was last scanned on 23 Nov 2026 at version 3.6.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: First and only release on 23 Nov 2026.
  • Findings: No rules fired in version 3.6.0.
  • Downloads: 1,599,282 downloads.

Versions

1 version published
Versions and the rules that fired in each
VersionPublishedStatus
3.6.0 LATEST 23 Nov 2026 No rules fired

No rules fired in 3.6.0

Findings

Findings for v3.6.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 3.6.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

PyGeoHash

Python Versions

A typed Python library for working with geohashes, with a compiled C core and prebuilt wheels for mainstream Linux, macOS, and Windows environments.

Full docs at pygeohash.mcginniscommawill.com

What is PyGeoHash?

PyGeoHash is a Python module that provides functions for encoding and decoding geohashes to and from latitude and longitude coordinates, along with utilities for performing calculations and approximations with them.

It was originally based on Leonard Norrgård's geohash module, but now adds more functionality while supporting Python 3, and is optimized for performance.

Why PyGeoHash?

  • Installs across mainstream platforms: Prebuilt wheels cover Linux x86_64 and arm64, macOS Intel and Apple Silicon, and Windows. Alpine/musl users build from source.
  • Compiled core: Geohash encoding and decoding run through the bundled CPython C extension.
  • Typed package: PyGeoHash ships a py.typed marker and type stubs for the C extension, with strict mypy checks in CI.
  • Zero runtime dependencies in the base install: Mapping features remain available separately through pygeohash[viz].
  • Geohash utilities beyond encode/decode: Work with neighbors, bounding boxes, approximate distances, statistical helpers, and optional maps.
  • Radius coverage: geohashes_in_radius(lat, lon, radius_m, precision=6) selects proximity candidate cells, including across the antimeridian and near poles (new in 3.6.0).
  • Map-tile interoperability: Convert geohashes to tile, quadkey, and integer forms (new in 3.6.0).

Installation

# Basic installation
pip install pygeohash

# With visualization support
pip install pygeohash[viz]

# With the cross-library benchmark comparison dependencies
pip install pygeohash[benchmark]

Quick Start

import pygeohash as pgh

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

# Control precision
short_geohash = pgh.encode(latitude=42.6, longitude=-5.6, precision=5)
print(short_geohash)  # 'ezs42'

# Decode geohash to coordinates
lat, lng = pgh.decode(geohash="ezs42")
print(lat, lng)  # 42.60498046875 -5.60302734375

# Encode or decode many items in one call (list, tuple, array.array, NumPy, generators)
geohashes = pgh.encode_many([42.6, 57.64911], [-5.6, 10.40744], precision=5)
print(geohashes)  # ['ezs42', 'u4prs']
points = pgh.decode_many(geohashes)  # list of LatLong, same as [pgh.decode(g) for g in geohashes]

# Calculate approximate distance between geohashes (in meters)
distance = pgh.geohash_approximate_distance(geohash_1="bcd3u", geohash_2="bc83n")
print(distance)  # 625441

# Get adjacent geohash
adjacent = pgh.get_adjacent(geohash="kd3ybyu", direction="right")
print(adjacent)  # 'kd3ybyv'

Visualization

PyGeoHash includes optional visualization capabilities:

# Plot a single geohash
from pygeohash.viz import plot_geohash
import matplotlib.pyplot as plt

fig, ax = plot_geohash("9q8yyk", color="red")
plt.show()

# Plot multiple geohashes
from pygeohash.viz import plot_geohashes

geohashes = ["9q8yyk", "9q8yym", "9q8yyj"]
fig, ax = plot_geohashes(geohashes, colors="viridis")
plt.show()

# Create interactive maps with Folium
from pygeohash.viz import folium_map

m = folium_map(center_geohash="9q8yyk")
m.add_geohash("9q8yyk", color="red")
m.add_geohash_grid(precision=6)
m.save("geohash_map.html")
Generating Example Visualizations

To generate example visualizations for the documentation, you can use the provided Makefile command:

# Install visualization dependencies
make install-viz

# Generate visualization examples
make viz-examples

This will create static images and interactive maps in the docs/source/_static/images directory.

Features

  • Encode coordinates to geohash strings
  • Decode geohash strings back to coordinates
  • Calculate approximate distances between geohashes
  • Find adjacent geohashes in any direction
  • Control precision of geohash encoding
  • Bounding box calculations
  • Visualize geohashes on static and interactive maps

Testing and Accuracy

PyGeoHash is extensively tested to ensure accuracy in geohash encoding and decoding:

  • Known Vectors and Precision Coverage: Fixed coordinate/geohash pairs and randomized checks exercise supported precision levels
  • Edge Case Coverage: Special attention to edge cases like poles, equator, date line, and precision boundaries
  • Roundtrip Consistency: Ensures encode->decode->encode operations produce consistent results
  • Regional Coverage: Test cases span all continents and major geographic features

To run the tests:

# Run the standard test suite
make test

# Run tests with coverage
make test-cov

Use Cases

  • Location-based services
  • Spatial indexing
  • Proximity searches
  • Geographic data clustering
  • Location encoding with privacy considerations
  • Geospatial data visualization

Blog Posts

For more insights about PyGeoHash, check out these blog posts:

Contributing

Contributions are welcome! Feel free to submit a Pull Request.

License

This project is licensed under the MIT license. See the LICENSE file for details. Prior to version 3.0.0's rewrite the project was licensed under the GPL-3.0 license.

Acknowledgments

  • Originally based on Leonard Norrgård's geohash module (since re-written)

Benchmarks

How PyGeoHash improved over time

Median time per call in nanoseconds — lower is better. Every cell comes from one measured session: the suite in tests/test_benchmark_comparison.py runs one discarded warmup pass and then three timed passes, and every measured call asserts its result; all five pygeohash columns were captured with the same 3.5.0 suite on one machine in one session.

Operation pygeohash 3.2.0 † pygeohash 3.3.0 † pygeohash 3.3.2 † pygeohash 3.4.0 pygeohash 3.5.0
encode 735 (725–743) 413 (413–417) 602 (602–721) 473 (472–476) 470 (470–474)
decode 4,315 (4,276–4,400) 944 (899–946) 1,023 (1,011–1,070) 616 (614–638) 584 (579–1,011) ¹
bounding box 4,267 (4,260–4,308) 1,516 (1,456–1,520) 2,455 (2,394–2,512) 1,192 (1,175–1,222) 1,067 (1,045–1,087)
is_valid_geohash 1,703 (1,639–1,710) 1,672 (1,638–1,674) 1,691 (1,681–1,703) 490 (484–498) 505 (499–510)
get_adjacent 2,580 (2,552–2,593) 2,582 (2,572–2,613) 5,924 (5,848–6,022) 1,384 (1,378–1,393) 1,382 (1,361–1,385)
get_adjacent (border wrap) 7,188 (7,163–7,209) 7,134 (7,097–7,156) 15,858 (15,680–16,266) 1,810 (1,798–1,821) 1,773 (1,710–1,774)
geohashes_in_box (4-cell, p9) 87,374 (87,124–88,156) 40,156 (39,642–40,449) 110,569 (107,392–110,930) 14,117 (14,088–14,729) 13,455 (13,312–13,583)
geohashes_in_box (361-cell, p6) 9,446,023 (9,248,468–9,485,611) 4,158,630 (4,129,873–4,282,572) 6,111,628 (5,925,939–6,130,139) 300,203 (298,570–309,776) 287,850 (286,010–289,168)
  1. All five pygeohash columns were measured with the same 3.5.0 suite on one machine (Linux x86_64, Intel Xeon @ 2.60 GHz, 8 vCPUs) in one session, in release order 3.2.0 → 3.3.0 → 3.3.2 → 3.4.0 → 3.5.0, every build from source on CPython 3.13.14. Per column: one discarded warmup pass, then three timed passes; each cell is the median of the per-run medians with the observed low–high range.
  2. † Releases 3.2.0, 3.3.0, and 3.3.2 predate #144's deterministic-sorted geohashes_in_box contract, so their columns were measured under a harness copy whose box-output assertions were relaxed to order-insensitive equality; every other assertion ran unchanged.
  3. ¹ The 3.5.0 decode range includes one disclosed transient pass; the quoted median is the suite's median-of-three aggregation, which is robust to it.

Relative to 3.2.0, the 3.5.0 column improves every measured operation: geohashes_in_box on a 361-cell box 9.46 ms → 288 µs (−97%); decode 4,315 → 584 ns (−86%); the 4-cell box 87.4 → 13.5 µs (−85%); the border-wrap adjacency 7,188 → 1,773 ns (−75%); bounding box 4,267 → 1,067 ns (−75%); is_valid_geohash 1,703 → 505 ns (−70%); get_adjacent 2,580 → 1,382 ns (−46%); encode 735 → 470 ns (−36%). The path was not monotonic: 3.3.2 measured as a real regression against 3.3.0 on several operations — get_adjacent +129%, the border wrap +122%, 4-cell box enumeration +175%, encode +46% — with the recoveries landing in 3.4.0. Between 3.4.0 and 3.5.0, decode improves 5.2% and bounding box 10.5%, while encode is unchanged within measurement resolution (−0.5%).

How PyGeoHash compares to other libraries

Median time per call in nanoseconds — lower is better. Every cell comes from the published comparison run of 2026-09-06 — same machine class, CPython 3.13.14, pytest-benchmark 5.3.0, one warmup pass plus three timed passes — a separate run from the session behind the over-time table above. An em-dash (—) marks a genuine API gap: the library does not expose the operation. An em-dash is never a placeholder.

Operation geohashr 1.6.0 pygeohash-fast 0.3.0 python-geohash 0.9.2 geohash-tools 0.2.0 pygeohash 3.5.0
encode 353 (341–361) 455 (451–455) 635 (630–644) 12,014 (11,994–12,183) 475 (473–576)
decode 231 (228–234) 545 (543–551) 791 (781–826) 8,439 (8,416–8,453) 554 (553–558)
bounding box 317 (313–318) — 929 (927–932) — 1,058 (1,043–1,125)
is_valid_geohash — — — — 382 (379–383)
get_adjacent 372 (360–378) — — 933 (907–933) 1,397 (1,379–1,406)
get_adjacent (border wrap) 358 (356–366) — — 2,267 (2,253–2,293) 1,798 (1,784–1,850)
geohashes_in_box (4-cell, p9) — — — — 13,602 (13,542–13,703)
geohashes_in_box (361-cell, p6) — — — — 293,134 (291,317–294,377)
  1. This table is backed by the separate published run (linked in the paragraph below), not by the session behind the over-time table — the two runs are distinct, and numbers are never mixed across them.
  2. The published run applies a 20% across-repeat stability gate after warmup and flagged pygeohash's encode spread at 21.6%, over that gate.

On this run, geohashr and pygeohash-fast are faster than pygeohash on encode and decode, geohashr and geohash-tools are faster on single-cell adjacency (on the border-wrap variant only geohashr is), and geohashr and python-geohash are faster on bounding box. No competitor exposes a standalone validity check (is_valid_geohash) or box enumeration (geohashes_in_box). The benchmarks page also measures two further pure-Python libraries, libgeohash and geolib, which trail far behind the libraries shown here.

Version history

The tables below compare PyGeoHash 3.0.0 to PyGeoHash 2.1.0 — a record of the v3.0.0 CPython rewrite, not a comparison against other libraries. They were produced with a much older pytest-benchmark and are kept for history only.

Version 3.0.0
Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations
test_encode_benchmark 614.0035 (1.0) 1,170,750.9984 (1.34) 1,119.5566 (1.0) 6,011.2433 (1.35) 714.0043 (1.0) 664.4987 (7.30) 370;1371 893.2107 (1.0) 117772 1
test_approximate_distance_benchmark 901.9859 (1.47) 872,125.0051 (1.0) 1,346.1119 (1.20) 4,467.1457 (1.0) 1,031.0032 (1.44) 90.9786 (1.0) 463;13144 742.8803 (0.83) 71891 1
test_decode_benchmark 2,791.9887 (4.55) 3,266,092.0115 (3.74) 4,683.3561 (4.18) 22,447.8219 (5.03) 3,102.9922 (4.35) 2,965.2583 (32.59) 103;302 213.5221 (0.24) 26769 1
test_haversine_distance_benchmark 3,989.0001 (6.50) 1,066,400.9897 (1.22) 5,441.2395 (4.86) 10,068.4850 (2.25) 4,475.0050 (6.27) 330.0083 (3.63) 429;3534 183.7817 (0.21) 28312 1
Version 2.1.0

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases pygeohash

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

PHP2Shell, Day 5 93.6% of Measurable Instances Still Unpatched (1)
Vulnerability Insights

PHP2Shell, Day 5: The Panic Hasn’t Turned Into Patching

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Frame 2085668439 (1)
Group 1261154229