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.2.tar.gz (71.7 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.2-cp311-abi3-win_amd64.whl (338.1 kB view details)

Uploaded CPython 3.11+Windows x86-64

rusty_polygon_geohasher-0.6.2-cp311-abi3-win32.whl (314.6 kB view details)

Uploaded CPython 3.11+Windows x86

rusty_polygon_geohasher-0.6.2-cp311-abi3-musllinux_1_2_x86_64.whl (730.3 kB view details)

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

rusty_polygon_geohasher-0.6.2-cp311-abi3-musllinux_1_2_i686.whl (769.0 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

rusty_polygon_geohasher-0.6.2-cp311-abi3-musllinux_1_2_armv7l.whl (790.3 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

rusty_polygon_geohasher-0.6.2-cp311-abi3-musllinux_1_2_aarch64.whl (681.9 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

rusty_polygon_geohasher-0.6.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.8 kB view details)

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

rusty_polygon_geohasher-0.6.2-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (562.2 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ i686

rusty_polygon_geohasher-0.6.2-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (514.9 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

rusty_polygon_geohasher-0.6.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (507.8 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

rusty_polygon_geohasher-0.6.2-cp311-abi3-macosx_11_0_arm64.whl (451.9 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

rusty_polygon_geohasher-0.6.2-cp311-abi3-macosx_10_12_x86_64.whl (472.2 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_polygon_geohasher-0.6.2.tar.gz
  • Upload date:
  • Size: 71.7 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.2.tar.gz
Algorithm Hash digest
SHA256 6c1661213ec42e5811b7795b3d5ab3d9b267bf0ad121c1c2aca5abd33b67efa8
MD5 7a25bed77eb9a59e92553e96b37b69a2
BLAKE2b-256 0c6393cd486bbea13279677883d36855d99220325a80c5d3118611a8c56e5fb3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a88d559bc3a2280b0d328638894020064470a5f9a425ab75aa361fe11dc25fc8
MD5 8ab343a1d0c5cddeb005974d414f1778
BLAKE2b-256 00f8fb4ff864939d367d3bfbe9f05c58062adf9f7067ea9a8b9f594cb3d8e162

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 1663febad1e24a5704473c71e8d5853722ffc7c2be66a2eb774e39ff183e665b
MD5 2e169eb26b60be42c01d05e26763870f
BLAKE2b-256 cacf7bbb15d7c75d3f237a9a54ca9ca5b7006558fcaa3e115af50c81eed09713

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8a2e85218324b3817db02d0a6e0cd3243b0510937d620cbafdce24cbf1e71729
MD5 1996f5da44d721246292a50c64d5ab6b
BLAKE2b-256 ee3eef0371c6bba7b2aec75e01f3a60c5b3a71672e4960f046a12e49f607f3d9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 32f0838488fbc56565aa5feb631a1d3d022a04099aadcf42070415eaf5aafbb5
MD5 2634d52cbbc47a883f194d25a5264ec8
BLAKE2b-256 d2e744885e1ff55530447ad461081b4eae43fe0792ee99b4fdd4e82bd37011f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 2a77786068da56a27e983102f482cfc74e9aba9dee91eb241be4fe09a3787a69
MD5 d3640bf46feecf63181a482360b4ffb9
BLAKE2b-256 79e8d2fd106b82ef195a5743c91dd7b84370a7e5dc929b1a82d52004e1845b1f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7d7b27453cf205650fcf61678057b06eca98c2efbd805a2bc4dd329ee8cc0b9b
MD5 fb288ca831fe3d9fad4c0d48eb582f18
BLAKE2b-256 9582940cc1460743a5da568e72e38e9e3ddd853e02983ad5744f254434c3977d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d22042ca521a2f2b480fcd582bac68a73d1bbbcd70dbfa3fe47eb7f7d81da5b
MD5 f2b602f7d8518047d6f7a59da4b0b9f8
BLAKE2b-256 79a51c5d22cb84235d8e90d272740e1444552b31ceca7aac1ba4a2d43a87088f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 bb91d9198ad817de737df47664d7235589f0da7dfcab2670f290d719c195161e
MD5 e41643ebed80fd6d5ca1e310bc5ea27d
BLAKE2b-256 4aad039dd640ca0581d545b4bad72cc2d003f7914fabf1487d4cbe11d36e2e08

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 ee3d365a77446b269c6bb4b37753d432ab5eff0ca16849662c62808d664c835d
MD5 e0108ff0d5d6e2730ee45ab45b1b5b60
BLAKE2b-256 dcac3a0b7841edee1fb97c9f6edff771248bf2133d7a35633ea61ba5867b6e68

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f24a17e4e2f5e439e786e5699cf9d8692c6a5c878857635f9a7786928afc5b5c
MD5 9b039a450eb861c8e72e0cb8aaa8501c
BLAKE2b-256 1a5ecf5a54c631aa54011e043c1952b8713fd0bb4211bc5a25f6e1026eb57347

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d7f9020ae0eebaa224aba09df49fc8369a2ead89883a59fc3ab9acb5036fc170
MD5 0d7ba1992eaeac3a36ac8d2d16a283a1
BLAKE2b-256 af476324053228076e35a8744f8132bcb125c59624b3d3d8810560ba867aeda3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.2-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 17aae6407efbd9f29b02ebe173c72ddef17e6451258d4a0371b13e0470d4d7c0
MD5 b542eb9971558b0f4d22f0dbd7386b72
BLAKE2b-256 d3264b3d1254332d076d4c28c1a9d8d4665be1bde81b057266d590c973319491

See more details on using hashes here.

Provenance

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