Skip to main content

Python bindings for the rstar R*-tree spatial index

Project description

rstar-python

Python bindings for the rstar R*-tree spatial index library.

Installation

pip install rstar-python

Usage

from rstar_python import PyRTree

# Create a 3D R-tree
tree = PyRTree(dims=3)

# Insert points
tree.insert([1.0, 2.0, 3.0])
tree.insert([4.0, 5.0, 6.0])

# Bulk load points
points = [
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
    [7.0, 8.0, 9.0]
]
tree.bulk_load(points)

# Find nearest neighbor
nearest = tree.nearest_neighbor([1.1, 2.1, 3.1])

# Find k nearest neighbors
k_nearest = tree.k_nearest_neighbors([1.1, 2.1, 3.1], k=2)

# Find neighbors within radius
neighbors = tree.neighbors_within_radius([1.0, 2.0, 3.0], radius=1.0)

# Query points within a bounding box
points = tree.locate_in_envelope(
    min_corner=[0.0, 0.0, 0.0],
    max_corner=[2.0, 2.0, 2.0]
)

# Get tree size
size = tree.size()

# Remove a point
tree.remove([1.0, 2.0, 3.0])

Features

  • Supports 1D to 4D points
  • Fast nearest neighbor queries
  • Radius search
  • Bounding box queries
  • Bulk loading for faster initialization
  • Built on top of the fast Rust rstar library

Development

Requirements:

  • Rust
  • Python 3.7+
  • maturin
# Clone repository
git clone https://github.com/kephale/rstar-python
cd rstar-python

# Create virtual environment
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows

# Install development dependencies
pip install maturin pytest

# Build and install in development mode
maturin develop

# Run tests
pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

rstar_python-0.0.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rstar_python-0.0.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl (382.2 kB view details)

Uploaded PyPymacOS 10.12+ x86-64

rstar_python-0.0.2-cp313-cp313-macosx_11_0_arm64.whl (354.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rstar_python-0.0.2-cp39-cp39-win_amd64.whl (257.2 kB view details)

Uploaded CPython 3.9Windows x86-64

rstar_python-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (418.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file rstar_python-0.0.2.tar.gz.

File metadata

  • Download URL: rstar_python-0.0.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rstar_python-0.0.2.tar.gz
Algorithm Hash digest
SHA256 880688d78507fa53faf40698ede9a24280db6fd02707dc3d604380cb23d62f6d
MD5 bca3f9e75b2d6b18a9cd1296890567d5
BLAKE2b-256 615f8bd3d3a77689c3fc169d6d43eb16eaff4c874081909b1b5bea1b94d11045

See more details on using hashes here.

Provenance

The following attestation bundles were made for rstar_python-0.0.2.tar.gz:

Publisher: test_and_deploy.yml on kephale/rstar-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rstar_python-0.0.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rstar_python-0.0.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0d156bf410542041e131eaac4580e8cca71a4ce148ae4f166bc6dff815181871
MD5 6b2bea5b4e938ebbdae94be7bc502869
BLAKE2b-256 264243658619cb604fbd0c8d2de6a1d8d8263db63ef65be8902794b9611f6ab9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rstar_python-0.0.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl:

Publisher: test_and_deploy.yml on kephale/rstar-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rstar_python-0.0.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rstar_python-0.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e743e57cace9d508fcf38015032011c6459a5346a1ffb6babcdc08850989e0ef
MD5 a39d8ce97253abe693c23ec7f9f8fd45
BLAKE2b-256 a4490c2b7fb5e043b0f89d30fb0cbed6424a505b662e1fefa2b80c2977e3b868

See more details on using hashes here.

Provenance

The following attestation bundles were made for rstar_python-0.0.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: test_and_deploy.yml on kephale/rstar-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rstar_python-0.0.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: rstar_python-0.0.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 257.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rstar_python-0.0.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8e3412908d2ac1c224f7cdc3adc0410110d183ac972421e84085c59b51d280de
MD5 8ad882fac12c5090da02278de73660ad
BLAKE2b-256 3ab85cd4c12f1797aee9000a295781e1c9864bd9ca84b5e25d08e1f1a184d4d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rstar_python-0.0.2-cp39-cp39-win_amd64.whl:

Publisher: test_and_deploy.yml on kephale/rstar-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rstar_python-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rstar_python-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c5dba6823688829938f9806ca11879e01d33c0d131659fbcbbfee52281e8b53
MD5 c58d1868435dc9a091afba32e0dbf87a
BLAKE2b-256 ec9ff51b42c0f8ca31376485f1ec692323fd7714595282b56a3a397fcb1ec70a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rstar_python-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: test_and_deploy.yml on kephale/rstar-python

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