Progressive, topology-aware, multiresolution geometry for the web.
Quadstream builds shared geographic topology once and reconstructs geometry at different levels of detail. The TypeScript ESM core has no runtime dependencies.
- Planar geometry: viewport selection, progressive binary partitions and cancellable loading.
- Spherical geometry: fractional detail, shared boundaries, visibility culling and clipping helpers for globe renderers.
- GeoJSON/TopoJSON adapters, a planar CLI and browser demos.
Node.js 20+ for the library.
npm install @vizhub/quadstream
import { buildQuadstream } from "@vizhub/quadstream"; const source = { type: "FeatureCollection", features: [ { type: "Feature", id: "square", properties: { value: 42 }, geometry: { type: "Polygon", coordinates: [ [ [0, 0], [10, 0], [10, 10], [0, 10], [0, 0], ], ], }, }, ], }; const dataset = await buildQuadstream(source, { maxLevel: 12 }); const result = await dataset.query({ level: 4, bounds: [0, 0, 10, 10] }); console.log(result.geojson, result.usedFallback);
Detail levels run from 0 (coarsest) to maxLevel - 1 (finest).
The returned feature collection can be rendered with your preferred renderer.
TypeScript users can annotate the source with the exported FeatureCollection
type.
The planar engine interprets coordinates as Cartesian numbers. Project or split dateline-crossing geography upstream; use the spherical API for great-circle globe geometry.
Use Node 26 for the React/Vite demo.
git clone https://github.com/vizhub-studio/quadstream.git
cd quadstream
npm ci
npm --prefix quadstream-globe ci
npm run devThe React globe is the GitHub Pages demo. It uses version-pinned CDN geometry sources, caches downloads and regional engines, and renders eligible administrative boundaries through Quadstream. Spherical simplification is in-memory, not network partition streaming. The legacy globe and progressive map remain available with npm run dev:legacy and npm run demo:map.
- Usage and API guide — progressive loading, spherical examples, CLI and API signatures.
- Architecture · Algorithmic complexity
- Spherical geometry · Progressive map · CLI
- React globe setup and deployment · Globe controls and provenance
- Roadmap · Contributing · History
- Supported shapes: Polygon, MultiPolygon, LineString and MultiLineString. No points, nested geometry collections, 3D coordinates or nonfinite positions.
- Only exact coordinate matches establish shared borders; no approximate snapping or differently digitized boundary reconciliation.
- Planar bounds filter whole features; they do not clip geometry. Planar IDs are normalized to strings, and null properties become empty objects.
- Full-detail reconstruction retains coordinates and order subject to documented normalization and cyclic ring starts. Coarse BLG subsets are nested, but validated output may not be monotonic when a fallback occurs.
- By default, invalid planar simplified geometry triggers a global full-detail fallback, not independent per-feature simplification. Partial results are explicit; validation does not prove global cross-feature topology.
- Reference polygon validity checks are quadratic; large-scale performance, measured screen-space error, robust global spherical predicates and production resource hardening remain future work.
- Binary checksums detect accidental corruption, not malicious changes.
See the architecture and roadmap for implementation details and planned work.
npm ci npm run check npm run lint npm run test:package
See the globe development guide for browser tests. The modern implementation is MIT-licensed; historical code retains its existing license terms. See LICENSE.
buildQuadstream and buildSphericalQuadstream return promises, as do dataset and session query methods. Pass signal, onProgress, onSlice, and sliceMs to cooperative operations as needed. The default build slice target is 4 ms; individual synchronous operations can exceed it. No Async suffix is needed. Cancellation rejects with the abort reason. Lightweight accessors, low-level geometry helpers, session construction, and atomic partition ingestion remain synchronous. Synchronous dataset reference methods are internal, not public TypeScript API.