Skip to main content

Fast, memory-efficient 2D spatial indexes for Python.

Project description

geoindex-rs

PyPI

Fast, memory-efficient 2D spatial indexes for Python.

API

KDTree

KDTree.from_interleaved

Construct an KDTree from a 2D numpy array of x and y. This must have two dimensions, with the second dimension having length two.

KDTree.from_separated

Construct an KDTree from two separated 1D numpy arrays of x and y. Each array must have one dimension and both arrays must have the same length.

KDTree.range

Search the index for items within a given bounding box.

Arguments:

  • min_x: float
  • min_y: float
  • max_x: float
  • max_y: float

Returns indices of found items

KDTree.within

Search the index for items within a given radius.

  • qx (float): x value of query point
  • qy (float): y value of query point
  • r (float): radius

Returns indices of found items

RTree

RTree.from_interleaved

Construct an RTree from a 2D numpy array of minx, miny, maxx, maxy. This must have two dimensions, with the second dimension having length four.

For example, the output of shapely.bounds is in this format.

import numpy as np
from geoindex_rs import RTree

geometries = shapely.polygons(...)
bounds = shapely.bounds(geometries)
tree = RTree.from_separated(bounds)

RTree.from_separated

Construct an RTree from four separate 1D numpy arrays of minx, miny, maxx, maxy. Each array must have one dimension and all arrays must have the same length.

import numpy as np
from geoindex_rs import RTree

minx = np.array([-10, ...], dtype=np.float64)
miny = np.array([-20, ...], dtype=np.float64)
maxx = np.array([10, ...], dtype=np.float64)
maxy = np.array([20, ...], dtype=np.float64)
tree = RTree.from_separated(minx, miny, maxx, maxy)

RTree.search

Search within an RTree for the given bounding box. Returns the indices of the input array that match the output.

tree = RTree.from_separated(...)
tree.search(minx, miny, maxx, maxy)

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

geoindex_rs-0.2.0b1.tar.gz (42.5 kB view details)

Uploaded Source

Built Distributions

geoindex_rs-0.2.0b1-cp38-abi3-win_amd64.whl (219.5 kB view details)

Uploaded CPython 3.8+ Windows x86-64

geoindex_rs-0.2.0b1-cp38-abi3-win32.whl (207.8 kB view details)

Uploaded CPython 3.8+ Windows x86

geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (742.8 kB view details)

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

geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (925.2 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ s390x

geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (761.0 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ppc64le

geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (760.8 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARMv7l

geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (744.7 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (756.1 kB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.12+ i686

geoindex_rs-0.2.0b1-cp38-abi3-macosx_11_0_arm64.whl (311.2 kB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

geoindex_rs-0.2.0b1-cp38-abi3-macosx_10_12_x86_64.whl (343.6 kB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

Details for the file geoindex_rs-0.2.0b1.tar.gz.

File metadata

  • Download URL: geoindex_rs-0.2.0b1.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for geoindex_rs-0.2.0b1.tar.gz
Algorithm Hash digest
SHA256 b22b6fb0302d5c73d7089c732af0b78264e5c90299226da2795ed23d8b3d796e
MD5 9547e080ce6075bac87d4cda9769e7fa
BLAKE2b-256 b2d3499e78d0b042396d78a0722633d8e7e3087bbe386c496955d349ae004a6c

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 01c61fd9c3d9f7a48e6581db7f08d383e8af2c2a9edf8869b0af44374ce3a54e
MD5 4c88d2ef53a53ad9537192524c426062
BLAKE2b-256 8fe04892fa41ed34768f1c2f910e37a9cdc233f6c880defa55f9a0a7f31463f7

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-win32.whl.

File metadata

  • Download URL: geoindex_rs-0.2.0b1-cp38-abi3-win32.whl
  • Upload date:
  • Size: 207.8 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 f74138b7f08e6ebb525bd21547c3758eb199d7c592a0fc3cf7ebc183a6506eba
MD5 6c7371e02f6de04a525ea9a66c4572ea
BLAKE2b-256 75882df1313bce2b654c76f2a2daebe08acff3e641e27ed7b72d7e7fdddbd332

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e21d8dcc9370d6cc656ce77bf5a7dfb01c1401a086e7e3887932cbe84ad4dbe9
MD5 771ef3f483a5017393a2ec9f821731ce
BLAKE2b-256 fc15f3c720f5d7a925b053680b6829d5be6a0d5f79c31f8dbbf67ba07292bdf7

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 8604a6b40f7f4b690adcf857be0c79aa5e0cbca8e5595a73700e58e2aecaf246
MD5 63e254c9a8a5edaff7f62bc381103444
BLAKE2b-256 f03c20c64400b9702ad05c61bdbab885f17ece60ce4577882520fb5b3f5100db

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 f7fb3b8169090a65d2eccca26beeddcccc42237bdbca72c7f5ee453748133f4e
MD5 fca239299be72959e8d789a22ff56930
BLAKE2b-256 aead5598196a173917d9a25547fe8d6509bb7aa4c9cefa898e9cb3a0a5970523

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 b993526baf40c1c30f72870be1f9e50385f7ce3860e6c1ecaea5ee670a9116a6
MD5 2c605da167c37831a94cccd6288d83cf
BLAKE2b-256 fa1f0d1e1852570bb2b07cbdebb7ecb15eedca75f15c3d21848af8a64393c302

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b61106bd29b4ca27e3de3b0c62d3889c8e889e3b234a7bf93bc7503e7a12f9d2
MD5 cc9e32a83d2d1a3f8d7cc722dc7948f1
BLAKE2b-256 d9fece78d77711c40744c5456150d5f38ddb01a2f07a76bf75fcef34e35ad29b

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 41fea5a1d9331c720e725faa1c476ba45bf0f357a4cec48c81cd2448921735ca
MD5 1960dd653a5ba4d14216892d62eb400e
BLAKE2b-256 7a95c2bb5dcc000e6c4e4253823c41a3529c26731c534f00fa556f2a18eace6a

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ee027083402daf7dad5d273bd33d59ef8e84fa4489b024d71c87f9d96b456f1
MD5 0f0a4f9cbbfdb69ed125fd0b93be9c92
BLAKE2b-256 425fa2cdcdb4f531d00778ad4739f04253edb14f1fc0b23bba10984d0defcda9

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.2.0b1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.2.0b1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 efd5bd2d33436915a881d6e48e1713fd03b126db8a24b326882a4a9cd655d79c
MD5 c19c21081b7b36680bbf0d4f263c6a4d
BLAKE2b-256 027ec5364f51f1b8a1a035711b9c976e4b2b7c94da3cc1652ed9fd864b9e6d33

See more details on using hashes here.

Supported by

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