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.0.tar.gz (64.4 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.0-cp311-abi3-win_amd64.whl (337.4 kB view details)

Uploaded CPython 3.11+Windows x86-64

rusty_polygon_geohasher-0.6.0-cp311-abi3-win32.whl (313.8 kB view details)

Uploaded CPython 3.11+Windows x86

rusty_polygon_geohasher-0.6.0-cp311-abi3-musllinux_1_2_x86_64.whl (729.3 kB view details)

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

rusty_polygon_geohasher-0.6.0-cp311-abi3-musllinux_1_2_i686.whl (768.8 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

rusty_polygon_geohasher-0.6.0-cp311-abi3-musllinux_1_2_armv7l.whl (789.4 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

rusty_polygon_geohasher-0.6.0-cp311-abi3-musllinux_1_2_aarch64.whl (680.9 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

rusty_polygon_geohasher-0.6.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.1 kB view details)

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

rusty_polygon_geohasher-0.6.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (561.4 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ i686

rusty_polygon_geohasher-0.6.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (514.1 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

rusty_polygon_geohasher-0.6.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (506.7 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

rusty_polygon_geohasher-0.6.0-cp311-abi3-macosx_11_0_arm64.whl (451.4 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

rusty_polygon_geohasher-0.6.0-cp311-abi3-macosx_10_12_x86_64.whl (471.4 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_polygon_geohasher-0.6.0.tar.gz
  • Upload date:
  • Size: 64.4 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.0.tar.gz
Algorithm Hash digest
SHA256 d40f7ba0bede7b537195037c571dd4e460789c1d764fd9e4dd04238405570f60
MD5 99153fbfb78bb7b85fe75f9131952d7a
BLAKE2b-256 537f70da15f1f7b83c007383ea0519b52e12ba17b874c9f532c99b315425947c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 584a3c5d838f53d093c7790b0f78ab8ae368b54397312f6d32cd8ee5d11578d0
MD5 0d6247492ff23293ec1324d5a10f9a66
BLAKE2b-256 a4ef9a320fd703c28466076835cda250881f93c3623d219ad4a014f24ff31b03

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 8c0882b0153afd78463e7e0cb2d47e52766f1cde55e6275f661ace681199d989
MD5 0c00fef51232c9f3070195a207feac3d
BLAKE2b-256 69b193459ba42dd43809bc96331f3d847f6069554c2292bd7366733d262ad874

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ad7bea8b37f967852d42584bbcf0ec328b7d3650e2f3c5af5a1ebfb92a2575e3
MD5 f2f69d69a433d9258986eee1859a0936
BLAKE2b-256 01abd1dcebda39d9e5db73624716e47382ad4141e70c861a5980a6314ad81c56

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 549c6257e91780726f8df6deb6b74021ca2ff5d5d6eb4c8bb6fc542fa6759c3d
MD5 451c785f157056eea4846d5ce3784c31
BLAKE2b-256 a029fe7cb1829786b483cc3dd3dfa5d7c9d4d755f0a29aeefeb2d71d4f32515e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 ce9b0f9db436f4429dd216865f0878b2b33448d62a526b7ac81d3823d9796a42
MD5 053d87c6b8c1405f64963c41cfe98594
BLAKE2b-256 9198cfb9b14dba7a101ed24bf72283fdabfb9d6c3610c4a0bdd938f97d9b11d1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 52981cd0879bb9bfa7250317ddf96626abf73ffdc843178ec24ec9761c297a01
MD5 6913ba33e688760d448b9f9be1638f4d
BLAKE2b-256 b1db158b475d4e49fcda99d79fc53d0316af28d316faa2016988f64eeb46b70a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0783076e3fbfa39c8420312b0acf70c9b1b9eae55796207949fd40f81fb53e3b
MD5 b43b6864b4d91708c153306a0191ad58
BLAKE2b-256 b402fbce7064f917d292c625cfc88c2da33e4927cc4592c3719073d9741bcbcc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f1942923c8a314561748771cfef84497bf9a5ca2d3245a2acf64c3c0c95be688
MD5 3e336a9f6bac4256d76db9f297f1546b
BLAKE2b-256 12ccb7c26488e946c2ac3a6b2d31028637127f5f517af7435defb5af036fc356

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 95b5cdc1524fb8f36dc865fb8edf16b3d04e35b1c720120cc453c2059fc327d4
MD5 0be041334a82699e5ef6acab56a37c7a
BLAKE2b-256 fa1d6361c6fdab8da400ba43bbdda4bd26e74d117d499c173183adcbede60255

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a66919def60174184f3d73bd465db5eda2a42224155e1cd1c1c1adec1750d28a
MD5 45212ca0d6611a9c8ee4b0eb567f82a7
BLAKE2b-256 8e3eb2dfd7118008f13abc5f46e5c11bbfa44455a904a4786100421d3a016846

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f9b9d15a1240ab57c5a2b0000d16ce28ce0fabb33df2ef6fac36ca08f6db7a26
MD5 4d2f5fe900a69e17c0c27204f879801e
BLAKE2b-256 92fc5fedeab52752618215985f4f81bfa2d38b1319e6cafd88d0b9362dfc1fbf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_polygon_geohasher-0.6.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c92c66ce2dea9e743ed67245a86684902815ec7872091e208d53dce0448cdaf0
MD5 97908c7de12d056ffb99a65834782ff4
BLAKE2b-256 87f29acee9ecda8b27955c16251dbe00815022d0726640176945737a89b7cfc7

See more details on using hashes here.

Provenance

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