A very fast static spatial index for 2D points and rectangles in JavaScript, using a packed Hilbert R-tree algorithm.
Flatbush is a high-performance static spatial index library for JavaScript that enables extremely fast spatial queries on millions of 2D points and rectangles. It uses a packed Hilbert R-tree algorithm to optimize bounding box and nearest-neighbor searches, making it ideal for handling large static datasets efficiently. The library is designed for applications like maps, data visualizations, and computational geometry where rapid spatial querying is essential.
JavaScript developers working with large-scale static spatial datasets, such as those in mapping applications, data visualization tools, or computational geometry projects. It is particularly suited for engineers who need to perform efficient spatial queries on millions of objects without dynamic updates.
Developers choose Flatbush over alternatives like RBush because it offers faster indexing and search operations with a significantly lower memory footprint, thanks to its static design and array buffer storage. Its unique selling point is the ability to transfer the index easily between threads (e.g., web workers) or store it as a compact binary file, enhancing performance in multi-threaded environments.
A very fast static spatial index for 2D points and rectangles in JavaScript 🌱
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show indexing 1 million rectangles in 273ms, over 4x faster than RBush, enabling rapid setup for large static datasets.
Uses a single array buffer for storage, reducing memory usage and allowing compact binary file storage or efficient network transmission.
Index data is transferable to web workers via postMessage without serialization, leveraging Transferable objects for high-performance parallel processing.
Supports both bounding box searches and k-nearest-neighbors queries, with optional filter functions for custom result handling, as detailed in the API.
Items cannot be added or removed after indexing, requiring a full re-index for any data changes, which is inefficient for dynamic applications.
Must specify the exact number of items during initialization, which can be restrictive and lead to wasted memory if over-allocated.
Optimal performance depends on manually adjusting the nodeSize parameter, necessitating benchmarking that may not be straightforward for all users.