zerometry

Zero-copy geometry storage and spatial relation queries over serialized geo data in Rust.

Library
Cargo
v0.3.0
0stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
9/100Needs Attention
Development Activity0
Maintenance0
Community4
Maturity32
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
69/100Good
Architecture78
Code Quality72
Innovation70
Learning Curve55

Zerometry is a Rust library that provides a zero-copy mapping over geo_types geometries, letting you store individual geometries as single byte values in a database like LMDB and compute relations between shapes without deserializing anything into RAM. It is designed to be quick, compact, and to operate directly on serialized buffers.

Built for cellulite, a geo database tailored for Meilisearch, zerometry focuses on the operations such a system needs: storing geometries on disk and finding shapes that intersect with, or are contained within, another shape. Types like Zoint and Zolygon serialize from geo_types and expose spatial predicates through a single relation trait.

What You Get

  • Zero-copy geometry types (Zoint, Zolygon, and more) that map directly onto serialized byte buffers
  • A single relation trait to query intersection and containment between shapes at once
  • Compact, disk-friendly encoding suitable for storing geometries as LMDB values

Common Use Cases

  • Storing individual geometries as values in an LMDB-backed geo database
  • Testing whether shapes intersect or are contained without deserializing them
  • Building spatial indexes that must keep memory usage and storage size low

Under The Hood

Architecture Each geometry type (Zoint, Zolygon, and friends) provides a write_from_geometry method that serializes a geo_types shape into a byte vector, and a from_bytes constructor that returns a view holding only a reference to that buffer. Spatial predicates go through a single RelationBetweenShapes trait where the caller specifies which relations (intersects, contains) to compute, returning them together in one pass. Tech Stack Rust (edition 2024) built on byteorder and bytemuck for zero-copy byte handling, geo-types for the source geometry model, and geo (with earcutr) for computational geometry. Dev dependencies include geojson, insta, and proptest. Code Quality Early-stage but test-conscious, with proptest regressions and insta snapshots under tests/. Scope is narrow and clearly tied to the cellulite/Meilisearch use case. API Design The serialize-then-view pattern is explicit about zero-copy semantics (views are read-only references into the buffer), and the combined relation query mirrors geo’s Relate trait while requiring callers to declare the predicates they need up front.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search