Skip to main content

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

Project description

geoindex-rs

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.1.0.tar.gz (39.0 kB view details)

Uploaded Source

Built Distributions

geoindex_rs-0.1.0-cp38-abi3-win_amd64.whl (209.6 kB view details)

Uploaded CPython 3.8+ Windows x86-64

geoindex_rs-0.1.0-cp38-abi3-win32.whl (202.5 kB view details)

Uploaded CPython 3.8+ Windows x86

geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

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

geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.3 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ s390x

geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.2 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ppc64le

geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.1 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARMv7l

geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

geoindex_rs-0.1.0-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl (1.2 MB view details)

Uploaded CPython 3.8+ manylinux: glibc 2.12+ i686

geoindex_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl (329.8 kB view details)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

geoindex_rs-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl (341.8 kB view details)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

File details

Details for the file geoindex_rs-0.1.0.tar.gz.

File metadata

  • Download URL: geoindex_rs-0.1.0.tar.gz
  • Upload date:
  • Size: 39.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 6805e7e81b34cc53e63a28f0374f799f886c21e39be7d82be7d7d50844962d4b
MD5 a6584650c38aa0e7eafd4025419a19b6
BLAKE2b-256 6ca3cc79e6096d96aeeafda10f77953d7801570d3e88c886b09070f02b5c9a45

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9708da00fafc825c81d1e38f5b76df398a6ea15fa7e2d450d54e797ee5ef8cdc
MD5 d75a664f6482aba1822494d84e3ab539
BLAKE2b-256 d6b7b829603960e932fc1a1d15bdf761c1a7c993df002c6d276131b82561fdab

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.1.0-cp38-abi3-win32.whl.

File metadata

  • Download URL: geoindex_rs-0.1.0-cp38-abi3-win32.whl
  • Upload date:
  • Size: 202.5 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.1.0-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 b8bac7fff93f34042bc757a9340ca0fefa5ccf870879e5a9a1d59d5294506f0f
MD5 1c7fe11569bbac3c742181c71c982539
BLAKE2b-256 1d14b5201e62d21ea26d603efeb125bd1c5836240a4a45a23ef1f049a4790930

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1af18d541a98d8658e7a5379ee36af942eb4cff0eafff941e24e22e357f743f
MD5 f353708350f5a703c0c15cbf333ffd66
BLAKE2b-256 91e4ca7e5e64cbc6eaa8288912cada1c17c153fe490cffd32fe1f5cf5d0299a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 fe1501d026ecd15f6a5e6b7ce55d3b5d7b190e67b012e819836f0e89daa8079d
MD5 cf13eb22ad84b8b7db3bb50d5471b69a
BLAKE2b-256 1fb10d31507d4bb1275c64655970f7902ed87029f7336cbe91f0a0894d62b5c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 0b5796b8496ebc06507e81e164d658908b198c196c5177fa43c0e90c22d55d82
MD5 44b6c0cb9ec1f83dda7329ad8e95dde6
BLAKE2b-256 ba78a635ae3cc2fa2179a91c7a8d00b6ae30fc846b5368efcf5d6b9690b7eb75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 ff8e127a187f159257a07252d766a2ef680f49c01f9841d0e4da0b3b2ceb9bb2
MD5 7062096cc2b630c02fb7b57e3e19b4ad
BLAKE2b-256 7cc55dbfca3ff89305feff8b90e2aacad8cca8dd47ef5d92f5756c5c34dc61c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb8210f99d0def52436e180cb1d5fe53e49b93296bd37a2fd18f58f67b82fd50
MD5 7a4b901befb6150b494a8e0bfe9a59d0
BLAKE2b-256 e699bbe372e364730bc3a6c0903a1a139daa5bb4e7671dfdc3c9e3b983e40598

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 adcf2b099b4b9d8afd5550c9da9bcacaae435294c27693a6a70f4b213edc69b1
MD5 fa4f05f16c5d59ca399abd4aacb1a687
BLAKE2b-256 904cfca805a817a5a51b02bb3e4ea47bb400be204f226afd349ec8b15023fccc

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1cd0f2413a53ac919eb04b57cf24fa2e6b18ae0a831ddf2cc876c2d4d496ea18
MD5 215137cd01b762730bb21893e19384d8
BLAKE2b-256 8ed2820dc6e4a5c2f4df8ccbc07af5e635c378a1bd8546d026d95cd61adab49d

See more details on using hashes here.

File details

Details for the file geoindex_rs-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for geoindex_rs-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d10e0f2b9a96c9358ba3e6d601ae26c605fcab6bce579abe649fb375de6b8a19
MD5 da7e41c3ec861f270a12992e331907da
BLAKE2b-256 31a04d1cd51c7bc83e3ecd1803d58a6beae7fc40d0e4b0f91de067921e6c2bb3

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