#spatial-index #spatial #kdtree #geometry #search-algorithms

kdbush

A very fast static spatial index for 2D points based on a flat KD-tree

2 unstable releases

0.2.0 Apr 21, 2020
0.1.0 Jun 17, 2017

#1878 in Algorithms

Download history 36/week @ 2023-11-27 28/week @ 2023-12-04 61/week @ 2023-12-11 68/week @ 2023-12-18 31/week @ 2023-12-25 33/week @ 2024-01-01 52/week @ 2024-01-08 78/week @ 2024-01-15 67/week @ 2024-01-22 50/week @ 2024-01-29 16/week @ 2024-02-05 44/week @ 2024-02-12 29/week @ 2024-02-19 133/week @ 2024-02-26 133/week @ 2024-03-04 141/week @ 2024-03-11

440 downloads per month
Used in 5 crates

ISC license

15KB
317 lines

kdbush

Documentation

A Rust port of kdbush, a very fast static spatial index for 2D points based on a flat KD-tree.

Introduction: A dive into spatial search algorithms

Comparison of point and box spatial index libraries.

Usage

let points = vec![(54.0, 1.0), (97.0, 21.0), (65.0, 35.0)];
let index = KDBush::create(points, kdbush::DEFAULT_NODE_SIZE); // make an index
index.range(20.0, 30.0, 50.0, 70.0, |id| print!("{} ", id));   // bbox search - minX, minY, maxX, maxY
index.within(50.0, 50.0, 20.0, |id| print!("{} ", id));        // radius search - x, y, radius

No runtime deps