Comparison of point and box spatial index libraries for JavaScript

April 17, 2020 ยท View on GitHub

LibraryStatic / DynamicCartesian / GeographickNNIndex containing pointsIndex containing boxesWithin radius
rbushdynamic:world_map: cartesian:x::heavy_check_mark::heavy_check_mark::x:
rbush-knndynamic:world_map: cartesian:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
kdbushstatic:world_map: cartesian:x::heavy_check_mark::x::heavy_check_mark:
geokdbushstatic:earth_asia: geo:heavy_check_mark::heavy_check_mark::x::heavy_check_mark:
flatbushstatic:world_map: cartesian:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
geoflatbushstatic: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.