Ex_rstar - Elixir NIF wrapper around the Rust rstar R*-tree spatial index

Elixir NIF wrapper around the Rust rstar R*-tree spatial index. Stores {x, y} points with optional arbitrary Elixir term data, backed by an opaque NIF resource that lives in Rust memory and is garbage-collected by the BEAM.

I created this because the erlang rtree implementations I could find looked dusty. Maybe you’d like to have rust doing these computes.

Features

  • Bulk-load points in O(n log n) via the R*-tree overlap-minimizing algorithm
  • Nearest-neighbor and k-nearest-neighbor queries (sorted by distance)
  • Bounding-box queries: contained and intersecting
  • Radius queries (squared Euclidean distance)
  • Exact point lookup, insert, remove, and drain
  • Optional per-point data — any Elixir term, serialized transparently
  • Precompiled NIF binaries for macOS (x86_64 + arm64), Linux (x86_64 + aarch64), and Windows — no Rust toolchain required for most users
  • Thread-safe: concurrent access from multiple BEAM processes via a Mutex

hex: ex_rstar | Hex
docs: ex_rstar v0.1.3 — Documentation
code:

6 Likes