Comparison of point and box spatial index libraries for JavaScript
April 17, 2020 ยท View on GitHub
| Library | Static / Dynamic | Cartesian / Geographic | kNN | Index containing points | Index containing boxes | Within radius |
|---|---|---|---|---|---|---|
| rbush | dynamic | :world_map: cartesian | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
| rbush-knn | dynamic | :world_map: cartesian | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| kdbush | static | :world_map: cartesian | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: |
| geokdbush | static | :earth_asia: geo | :heavy_check_mark: | :heavy_check_mark: | :x: | :heavy_check_mark: |
| flatbush | static | :world_map: cartesian | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| geoflatbush | static | :earth_asia: geo | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Definitions:
- Static: All items must be added to the index initially, they cannot be modified once initialised.
- Dynamic: Items in the index can be added and removed at any time
- Cartesian: Operations an x, y Cartesian coordinates.
- Geographic: Operations on geographic coordinates, lng, lat on a spheroid earth accounting for curvature of the earth and wrapping around the dateline.
- kNN: Find the k (arbitrary number) of items closest to the query point
- Index containing points: The index can contain points as items.
- Index containing boxes: The index can contain rectangles or bounding boxes as items.
- Within radius: Find all the items within a distance of the query point.