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.1.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.1-cp311-abi3-win_amd64.whl (338.0 kB view details)

Uploaded CPython 3.11+Windows x86-64

rusty_polygon_geohasher-0.6.1-cp311-abi3-win32.whl (314.3 kB view details)

Uploaded CPython 3.11+Windows x86

rusty_polygon_geohasher-0.6.1-cp311-abi3-musllinux_1_2_x86_64.whl (729.8 kB view details)

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

rusty_polygon_geohasher-0.6.1-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.1-cp311-abi3-musllinux_1_2_armv7l.whl (790.0 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

rusty_polygon_geohasher-0.6.1-cp311-abi3-musllinux_1_2_aarch64.whl (681.7 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

rusty_polygon_geohasher-0.6.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.7 kB view details)

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

rusty_polygon_geohasher-0.6.1-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (562.3 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ i686

rusty_polygon_geohasher-0.6.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (515.0 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

rusty_polygon_geohasher-0.6.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (507.6 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

rusty_polygon_geohasher-0.6.1-cp311-abi3-macosx_11_0_arm64.whl (451.8 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

rusty_polygon_geohasher-0.6.1-cp311-abi3-macosx_10_12_x86_64.whl (471.8 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_polygon_geohasher-0.6.1.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.1.tar.gz
Algorithm Hash digest
SHA256 7c97be81c606f2081faced194ae34c3f51bfdafa3519e46f7fa129975b5edaae
MD5 a9ea641e40eaeff5b06fadf4e4c933e1
BLAKE2b-256 90c585a58012b8d1086746b872b9d6f936c8dce72adec2b156666a65a3ae67cc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1bebbb3ed0d6fe75f2ef1940c3046bd0961608a366934bed6f57a75227138e75
MD5 2ddef5856e52a915cccfffe6d822edea
BLAKE2b-256 742a7213c479261b8b35a0e8a1fa87cf4a96d25bef294e3e43b67b343d75b6e4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 146d8bb8d47fb50322dad2af98ce640ee6ea0b792ca4294db8e94c2496af1112
MD5 799f6ddb1750dbf2c7dffb5a6a1c1ea3
BLAKE2b-256 c4b6e3c2506498904fd44d7b09e00b25f66c3a22c05656a7243f76ac6f15e113

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 900f544b4d7cc2cf960964b15787717ffd1ea55247e4047c4a4c92c0d10d57f0
MD5 ecb754287fc51f223dd8ce4c2552ab98
BLAKE2b-256 4539ccddc03c4dff5abd99b2dfc98cd684ac911458b6121ecc1a7be8008e7230

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 42742af9119e9dd9a7ca8cb29cf55d9dd9892830ff26de872c2b6ec6942c1329
MD5 a25159160e41c553360167ec1a9576de
BLAKE2b-256 288083c3ea1c5932769526ccc754af30399dd2378d058413a1ca71e36946238e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 300c68890f11a3462362b84205f688c23da84bad32535f569bd680372e012054
MD5 a8c67f3b2cef529207ef9778fe140681
BLAKE2b-256 7eae73fbd38fb61621774cab40a011f3f2a1a6b4399f6672b30917b0a799afb2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7cd03c9bcb0bb97ce01d2fbfbdc18c07f2f45bc22e80d192f34e3ad6d8be5eca
MD5 afaa23b5efcaa0b465ac0d6a842bef05
BLAKE2b-256 f8ccc14a07d545fc73d785c37b926308fcf44aa2eceb5554c68f1b8b65318557

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b41f593cbbdec0a89d52e8abce9e50a3c65330d83bfb701f2595097a9542a5b
MD5 a6954c98d2a015896496cf1ad68b6f3f
BLAKE2b-256 9fc22ba6dc4b18c083be6f107e0f71d05f68148e5a4dc4ee99d4da6faf8aaca4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 96e1dcb8e228fbd9a4be3cacd3a9bb7dcff642f888f4ce161b58f91186a1380a
MD5 38a629d8b85a48638cfd5c4967a1e927
BLAKE2b-256 2dc50f0a8fe995403fe025a66da663cc9ef46687f2ed4b608a6dcbca81d94131

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 9cfc200fba503172740e02ea43b365660048b9053ebde432f6e4ce26c7d5bd28
MD5 1754d1ec7309b0d27e6f4f6e5df9c8b0
BLAKE2b-256 01a8234fd14c54cfcf4d3221e2f9c8af36d57bd000cde662da0e30ae669ec9bc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1c6d8b3a600b08aaabd54ce8ebc7192bf6978e20d307c03872e47c5b6033028a
MD5 213f73cb7b11452c4a2c59df0b11ffd7
BLAKE2b-256 8f6fc579d32f311eb3b97a8745bf95eecfb5f5ce09d1bd7db13e504aeade827c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3cfb4bd252e303742a1b4285397678fc2384e622cff2d48c0a227ea78f14d4f7
MD5 98c3d82cefd99bbb836fd36d31d571ba
BLAKE2b-256 3ed4f05f75c07fd8a9b83ee1935e14634a6e30349d9613bc7e83deaf45dd88db

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5894e423e3003f8fc265c5ab73bb2bcbb13a6c2528c26dbff3af5a6f58125f12
MD5 1a49f40c7ecce9099a0cabc91ab53065
BLAKE2b-256 abf747b88e26d79400bb32bf3f0951438fa171ea65ba9be8b9432135cb06de12

See more details on using hashes here.

Provenance

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