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
: floatmin_y
: floatmax_x
: floatmax_y
: float
Returns indices of found items
KDTree.within
Search the index for items within a given radius.
qx
(float
): x value of query pointqy
(float
): y value of query pointr
(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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for geoindex_rs-0.1.0-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9708da00fafc825c81d1e38f5b76df398a6ea15fa7e2d450d54e797ee5ef8cdc |
|
MD5 | d75a664f6482aba1822494d84e3ab539 |
|
BLAKE2b-256 | d6b7b829603960e932fc1a1d15bdf761c1a7c993df002c6d276131b82561fdab |
Hashes for geoindex_rs-0.1.0-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8bac7fff93f34042bc757a9340ca0fefa5ccf870879e5a9a1d59d5294506f0f |
|
MD5 | 1c7fe11569bbac3c742181c71c982539 |
|
BLAKE2b-256 | 1d14b5201e62d21ea26d603efeb125bd1c5836240a4a45a23ef1f049a4790930 |
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 |
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 |
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 |
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 |
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 |
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 |
Hashes for geoindex_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cd0f2413a53ac919eb04b57cf24fa2e6b18ae0a831ddf2cc876c2d4d496ea18 |
|
MD5 | 215137cd01b762730bb21893e19384d8 |
|
BLAKE2b-256 | 8ed2820dc6e4a5c2f4df8ccbc07af5e635c378a1bd8546d026d95cd61adab49d |
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 |