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.2.0b1-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01c61fd9c3d9f7a48e6581db7f08d383e8af2c2a9edf8869b0af44374ce3a54e |
|
MD5 | 4c88d2ef53a53ad9537192524c426062 |
|
BLAKE2b-256 | 8fe04892fa41ed34768f1c2f910e37a9cdc233f6c880defa55f9a0a7f31463f7 |
Hashes for geoindex_rs-0.2.0b1-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f74138b7f08e6ebb525bd21547c3758eb199d7c592a0fc3cf7ebc183a6506eba |
|
MD5 | 6c7371e02f6de04a525ea9a66c4572ea |
|
BLAKE2b-256 | 75882df1313bce2b654c76f2a2daebe08acff3e641e27ed7b72d7e7fdddbd332 |
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 |
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 |
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 |
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 |
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 |
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 |
Hashes for geoindex_rs-0.2.0b1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ee027083402daf7dad5d273bd33d59ef8e84fa4489b024d71c87f9d96b456f1 |
|
MD5 | 0f0a4f9cbbfdb69ed125fd0b93be9c92 |
|
BLAKE2b-256 | 425fa2cdcdb4f531d00778ad4739f04253edb14f1fc0b23bba10984d0defcda9 |
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 |