# mourner/flatbush

A very fast static spatial index for 2D points and rectangles in JavaScript 🌱

Repository: https://github.com/mourner/flatbush
Canonical: https://ross.abutalabs.com/products/flatbush
Language: JavaScript
License: ISC
License Family: permissive
Topics: javascript, r-tree, spatial-index, algorithm, computational-geometry, data-structures
Last push: 2026-07-08T18:37:38+00:00

## Health v2 (maintenance only)
Score: 87/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 91, release rhythm 75, longevity 100
- inputs: {"age_days": 3109, "days_push": 56, "days_rel": 85, "gap_med": 34, "n_releases_24m": 6}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1597, forks 64 (observed 2026-08-28T04:05:09.260377+00:00)

## What it is
Flatbush is a very fast static spatial index for 2D points and rectangles in JavaScript, implementing a packed Hilbert R-tree. It supports bounding-box and k-nearest-neighbor queries over millions of items, with the index stored as a single transferable array buffer.

## Use cases
- index millions of rectangles for fast bounding box queries in JavaScript
- find k nearest neighbors to a point in a large 2D dataset
- speed up map rendering and hit-testing in data visualizations
- transfer a spatial index between web workers via a single array buffer
- serialize a compact binary spatial index to a file and reload it
- accelerate computational geometry algorithms like polygon intersection tests
- index geographic locations for spatial search with geoflatbush

## When to choose
- your dataset is static or rebuilt infrequently and you need maximum indexing and query speed
- you need a low-memory spatial index that serializes to a single array buffer
- you query millions of points or rectangles for maps, charts, or geometry algorithms
- you want to transfer the index between threads or persist it compactly

## When to avoid
- you need to add or remove items after building the index - use RBush instead
- you need dynamic incremental indexing with frequent updates
- you need 3D or higher-dimensional spatial indexing
- you need full-text or non-spatial search

## Facets
- artifact type: library
- maturity: stable
- function: search-engine, geospatial, data-visualization
- domain: data-visualization, web-development
- platform: browser
- tags: spatial-index, r-tree, hilbert-curve, k-nearest-neighbors, bounding-box-query, computational-geometry, static-index, array-buffer, zero-dependency, geospatial, algorithms, maps, javascript, nodejs, web-server

## Member repositories
- mourner/flatbush (main) score 87

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:09.260377+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:54:00.315357+00:00, confidence not recorded.
  - readme: https://github.com/mourner/flatbush (fetched 2026-08-28T04:05:09.260377+00:00, sha d550a3b7be29)
  - registry_npm: https://registry.npmjs.org/flatbush (fetched 2026-08-29T11:25:01.003114+00:00, sha 50ad2bfd74e2)
- Data as of 2026-08-30T08:39:29.467469+00:00.
