21 unstable releases

0.11.0 May 31, 2023
0.10.0 Jan 31, 2023
0.9.3 Apr 6, 2022
0.9.2 Nov 18, 2021
0.1.0 Nov 22, 2018

#17 in Algorithms

Download history 33355/week @ 2023-08-11 32557/week @ 2023-08-18 33644/week @ 2023-08-25 31201/week @ 2023-09-01 33532/week @ 2023-09-08 36005/week @ 2023-09-15 34363/week @ 2023-09-22 32812/week @ 2023-09-29 39004/week @ 2023-10-06 37086/week @ 2023-10-13 39353/week @ 2023-10-20 37374/week @ 2023-10-27 36590/week @ 2023-11-03 37251/week @ 2023-11-10 34473/week @ 2023-11-17 27661/week @ 2023-11-24

142,741 downloads per month
Used in 185 crates (37 directly)


3.5K SLoC


A flexible, n-dimensional r*-tree implementation for the Rust ecosystem, suitable for use as a spatial index.


  • A flexible r*-tree written in safe rust
  • Supports custom point types
  • Supports the insertion of user defined types
  • Supported operations:
    • Insertion
    • Rectangle queries
    • Nearest neighbor
    • Nearest neighbor iteration
    • Locate at point
    • Element removal
    • Efficient bulk loading
  • Features geometric primitives that can readily be inserted into an r-tree:
    • Points (arrays with a constant size)
    • Lines
    • Rectangles
  • Small number of dependencies
  • Serde support with the serde feature
  • no_std compatible (but requires alloc)


Primitives are provided for point, line, and rectangle geometries. The geo crate uses rstar as an efficient spatial index and provides RTreeObject implementations for storing complex geometries such as linestrings and polygons.


All benchmarks are performed on a i7-8550U CPU @ 1.80Ghz and with uniformly distributed points. The underlying point type is [f64; 2].

Benchmark Tree size Time
bulk loading 2000 229.82 us
sequentially loading 2000 1.4477 ms
nearest neighbor (bulk loaded tree) 100k 1.32 us
nearest neighbor (sequential tree) 100k 1.56 us
successful point lookup 100k 177.32 ns
unsuccessful point lookup 100k 273.51 ns

Project state

The project is being actively developed, feature requests and PRs are welcome!


The documentation is hosted on docs.rs.

Release Checklist

The crate can be published by the rstar-publishers team of georust. Please follow the steps below while publishing a new release.

  1. Create branch from master, say release/<version>.
  2. Ensure rstar/CHANGELOG.md describes all the changes since last release (esp. the breaking ones).
  3. Ensure / set version metadata in Cargo.toml of rstar to the new version.
  4. Create PR to master, have it approved and merge.
  5. Checkout the updated master, go to rstar directory and run cargo publish.
  6. Create tag <version> and push to georust/rstar


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~27K SLoC