Skip to main content

No project description provided

Project description

CI Package version

rusty-polygon-geohasher

A Rust-backed Python library for geohash operations: converting Shapely polygons to geohash sets, encode/decode, and geography expansion. All compute-heavy paths use Rayon for parallelism.

Originally based on polygon-geohasher (pure Python).

The encode/decode functions are a maintained replacement for pygeohash-fast, which is no longer actively maintained.

Installing

pip install rusty-polygon-geohasher

Usage

Polygon → geohash set

import geohash_polygon
from shapely import geometry

polygon = geometry.Polygon([(-99.1795917, 19.432134), (-99.1656847, 19.429034),
                            (-99.1776492, 19.414236), (-99.1795917, 19.432134)])

inner = geohash_polygon.polygon_to_geohashes(polygon, precision=7, inner=True)
outer = geohash_polygon.polygon_to_geohashes(polygon, precision=7, inner=False)

Encode / decode

All functions use (lng, lat) order consistently — encode takes (lng, lat) and all decode functions return (lng, lat, ...).

# Single encode/decode
h = geohash_polygon.encode(lng=-73.554, lat=45.508, precision=7)
lng, lat, lng_err, lat_err = geohash_polygon.decode_exactly(h)

# Batch (parallel via Rayon)
hashes = geohash_polygon.encode_many(lngs=[...], lats=[...], precision=7)
centers = geohash_polygon.decode_many(hashes)           # list of (lng, lat)
exact   = geohash_polygon.decode_many_exactly(hashes)   # list of (lng, lat, lng_err, lat_err)

# Optional thread count
geohash_polygon.encode_many(lngs, lats, 7, num_threads=4)
geohash_polygon.decode_many(hashes, num_threads=4)
geohash_polygon.decode_many_exactly(hashes, num_threads=4)

Expand geohash mappings

Expand each geography's geohash set outward by a given distance in metres. Useful when you want to count or join points-of-interest slightly outside a geography's boundary.

# Single group
expanded = geohash_polygon.expand_geohashes(["f25dvz3", "f25dvz4", ...], expansion_m=500.0)

# Multiple groups — result[i] is the expanded version of groups[i]
groups = [["f25dvz3", "f25dvz4", ...], [...]]
expanded_groups = geohash_polygon.expand_geohash_mapping(groups, expansion_m=500.0)

The hop count is derived from the minimum cell dimension (accounting for latitude-dependent cell width), so expansion is accurate in all directions including east/west at high latitudes. All hashes in a group must have the same precision. Geography expansion runs in parallel across groups.

WKB / EWKB output

Convert geohash bounding boxes to binary WKB or EWKB polygons for direct use in DuckDB (ST_GeomFromWKB) or PostGIS geometry columns.

hashes = ["f25dvz3", "f25dvz4", ...]

# Plain WKB — 93 bytes per hash
wkb_list = geohash_polygon.decode_many_to_wkb(hashes)

# EWKB with embedded SRID — 97 bytes per hash (default srid=4326)
ewkb_list = geohash_polygon.decode_many_to_ewkb(hashes)
ewkb_list = geohash_polygon.decode_many_to_ewkb(hashes, srid=32632)

# Optional thread count
geohash_polygon.decode_many_to_wkb(hashes, num_threads=4)
geohash_polygon.decode_many_to_ewkb(hashes, num_threads=4)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rusty_polygon_geohasher-0.6.3.tar.gz (80.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rusty_polygon_geohasher-0.6.3-cp311-abi3-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.11+Windows x86-64

rusty_polygon_geohasher-0.6.3-cp311-abi3-win32.whl (2.9 MB view details)

Uploaded CPython 3.11+Windows x86

rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_i686.whl (4.2 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_armv7l.whl (4.0 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (4.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ i686

rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.6 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

rusty_polygon_geohasher-0.6.3-cp311-abi3-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

rusty_polygon_geohasher-0.6.3-cp311-abi3-macosx_10_12_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file rusty_polygon_geohasher-0.6.3.tar.gz.

File metadata

  • Download URL: rusty_polygon_geohasher-0.6.3.tar.gz
  • Upload date:
  • Size: 80.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rusty_polygon_geohasher-0.6.3.tar.gz
Algorithm Hash digest
SHA256 a7948af591a5c160fab65108f83e5691ad444283f633bf8e51b454f6fa61f7f6
MD5 450dd311f786c535f455a070580f1fa3
BLAKE2b-256 164524ac33aa413389f9dabe9b87145545978a9707056f3096fda00169310243

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3.tar.gz:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 01aa4d30b7d3bca406c74103af6d683ce1a43fd29e7d267acf20a3c7c5d18ec3
MD5 42173741323ade047f3b4a081ed9baac
BLAKE2b-256 819392ac13abccedbcd0b7998c22848e4c8857fa0b4afd036afc82693b1b11eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-win_amd64.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-win32.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 4c3c6f31ac450656d135ef89b4f4120001463249f1b6fd6076a3884f78329fc0
MD5 7a5b34be6f46270e85dff98e73e8b656
BLAKE2b-256 eea8fce3a36e2544f4ab23341268e89990cf31a8af7b2b6399a37474cefe383d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-win32.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3839f358871e023106774f6b7bb6a5580ca529f8c92abc4b8aaed5e114af4c83
MD5 dd054f47b1dc5c4fc9fa4ff2f88feca4
BLAKE2b-256 c97853dcc49e43ecd05df7d719a68fece0afadee9e9dd1c86ba497be3f8dab0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_x86_64.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 3730c268da6fef09ca263627aaf36a8dfac7dbfe60077d3d9f38135526f5a49d
MD5 ad841338fb77da9aa7b06a4b19b69dc9
BLAKE2b-256 d6c61fa70b188d24d7801d2437b9fa2130e891890568635b9f859f1c4e326c13

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_i686.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 0f36bb3fd65ef81efad17edcd08782100430581f8c5c43e70a8107ed957dd97b
MD5 8c5f18ba59f9e840b4d204139f8a3125
BLAKE2b-256 62a6867c273330d10aa361056248ee25af6398bb8545fe9186f8570f26f3a38c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_armv7l.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 69a2e8aa8861a0c094f7f87de2a2bd207a796b579456c2a856a83f90b313f3ab
MD5 1fb15ca37c75306b9a1185d93528bede
BLAKE2b-256 eb4c020c5190d1d49463917be2599bb7303bb9bb1f5821f0ab338e68e2cd94ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-musllinux_1_2_aarch64.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4febbb77db8007e65be33622c5b6829b99f07e03debf8fcf1b757b625e78536d
MD5 8f2c892602b07b269b69f7db03f1483b
BLAKE2b-256 122ab23ac8153d814cdf5bb5000b9721307c8396a22fda801a979c938b0da6e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 66be1e93ddee06afd86a1f7a254d3fb891da9e8f2a3b1e962ea450ee80bb434c
MD5 51163918136c8b648c31b3c4d4f1ca36
BLAKE2b-256 3e2c4204bc58e1f956c9fec7dcbcc5ee824efe83bdecb396a8d2fb17fc715dd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c2f1a2c5e6816b5850566db6845997a22f81c05dcaec7b19cb46e8aa7c47314d
MD5 923aec99d000f0e0b3133f5bf1383080
BLAKE2b-256 3573213457e6b0719b0b178f9738f91518d187e8b86f971cd7245701ee4059b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2eecb3eda0fc4deee735145a366bfc98ca9475096f19c54042c0b81083c31ee3
MD5 20f740c679b798ff079da7b366cc5cbd
BLAKE2b-256 ae3e26e995edf1a44add0839fa7e6c21c2df75126f54e653a42366c35fa2cb97

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e1b692dbecafcae6c9ef2d9ba9f7c92418835cb66a6f4743ee881f7e7124adeb
MD5 772463c15b42151df4bf34f22e75de46
BLAKE2b-256 83a599a2681e2e9c2077ef9bd51f16273d68cd8150d7b03c471758104f2adbfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rusty_polygon_geohasher-0.6.3-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.3-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6bb4300949760f3478f46223d195a00c98f3bfc8586441c01d21917a5e5729a1
MD5 17daf5b0ef851b9e0df0a5ad0dbf7597
BLAKE2b-256 84a2cd2659321b0e4324f1d32410f34e352c065e6b176539bd665f7e243a513e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.3-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: CI.yml on nexmoov/rusty-polygon-geohasher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page