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.4.tar.gz (82.3 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.4-cp311-abi3-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+Windows x86

rusty_polygon_geohasher-0.6.4-cp311-abi3-musllinux_1_2_x86_64.whl (4.0 MB view details)

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

rusty_polygon_geohasher-0.6.4-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.4-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.4-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.4-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.4-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.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

rusty_polygon_geohasher-0.6.4-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.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: rusty_polygon_geohasher-0.6.4.tar.gz
  • Upload date:
  • Size: 82.3 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.4.tar.gz
Algorithm Hash digest
SHA256 9ec7fe30b27c889b62ade3bf428f2ea45721ce973f751dc0edbf9cc36631e81f
MD5 2773ec5775e0e56b63ed698a34626080
BLAKE2b-256 7c8ea951295518a16d99e82ca2daaf9b7b98cc86b12d177144ee63339f86b143

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4.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.4-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 38053737c7a78c20dde6e9c1470eaef72c6d40661b4a789ce3c6dc2e86c59665
MD5 c7e6ddc9f5fdacffbe8cd32c3ee86576
BLAKE2b-256 50dce36e24542e4cda5ceebb5de645e255912b7fc7d084783bfdee561f6fc685

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-win32.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 7dfe09c4753cc6f34bdb899fe254fd1091eda3eb9a78d3fbc9ac7649816f366b
MD5 47a84785fb166ef81a63dadfe0ce7e4b
BLAKE2b-256 dcf58734a21f050780f8d250a4315897197c74885d160209f533aa361c1e9aff

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7a456037ecd42b0f395a809c8cc9174a2ebd61d7cf537d82c0e2678530ccfc50
MD5 271720ddb4aa5ffdea2253ee88817297
BLAKE2b-256 d6068687d243552a8c4c25c6a5b5fc486e7f89025d789f7154785762644c5fcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 bed038a87b46bd296b8250aacc6ddb1690341f725b56380951601714997e2ef3
MD5 b52f09c5d63e4285e9e024516b7241d1
BLAKE2b-256 3643ae9b049045c7314d6a6d6d0f7b8d6e029e0f2a106fadc002fbc38c2fac8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 c479077302a37ba5fb6f3cf9ca7c70f30697cc69c8714a38a577ca398d63ea28
MD5 36f436c0b4d65a50f03ee0c9f5f9a931
BLAKE2b-256 3ac17e8697f931e614cae460e00ba8338fa3f66cb221ebf1b467745af857ea4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8ce787bce42f8e758886a6fd2f801ea5f49a17a5f8388e951508527919512bdb
MD5 aaca68c0e68080140c8c2270ffcff555
BLAKE2b-256 77fe1a239d971dcde4e25aab5039a39a9af36ae140f70e92c7817603e4ce7312

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 141f46051f6a6cf9054881db57ab2536599acd4cc3b6e872d5344e12da50ad52
MD5 4975c9c498b472019fd09ab3d5ed4fd1
BLAKE2b-256 3dcf2d15cf76d39363a91f0e21a0bc32de0b34e103ad8c9d2728170c0788a01f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 cf11efe2b930090304e6a546e039624126f14b086e7ee5c4369fa93ff2d8c769
MD5 96ef3cdc87dd354fd2fa6b82419e84fe
BLAKE2b-256 3ae33ecb534582ce9e1bf62b6765379883da9439ed735a8fdcb9921998f771c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 44da030bfe84e206ee5cd6c2de98e534d399a8748ebc5e678e255eaee7837c87
MD5 d5361812f2641d9778ae2cdef417da59
BLAKE2b-256 eff2c2163a124acfc3ba5a9106a97444ec5f2a49a7114c1c44a9c3765307037a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1f29834e9747035e1ccbac63f3c9e385481c784bbc34f1439acad21dbfd3ca40
MD5 19e926e9446c519dac175dad245090c9
BLAKE2b-256 70a4b117f15d8e980477bae68b3d55c47a1a81df655a7ee9e0e2dac916c2f0b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfcc5d6e83018c00ebc1a92461a6fc90410c4f61d14c4ec6b42ebe6135efd1fb
MD5 9ad1476a8f065a61dbc933d16fc3b628
BLAKE2b-256 0c5dc7c1c589818e4df475df16e46d6f6dd1961a49f8ddb0b4655c803c1d568c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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.4-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.4-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 78fbd7ba838211b07b0ec121b2f042f780f2c433d4d5f881b9cc017fb2a7b073
MD5 952fff720f7765f214f3c15c08760c2a
BLAKE2b-256 2c849021cf90955ddf51192f732ca2c5b62b3c3c6a244bd5f88b4c4106112cf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_polygon_geohasher-0.6.4-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