webxtile
v0.0.8
Published
Browser client for the webxtile octree format — partial bbox loads for web visualisation
Downloads
66
Maintainers
Readme
webxtile (JS)
Browser client for the webxtile octree format. Read-only; designed for partial bbox loads and level-of-detail rendering in web applications.
The Python library writes a directory of msgpack tile files. This library reads those files over HTTP, caches them in IndexedDB, and returns flat typed arrays suitable for WebGL / point-cloud rendering.
Installation
npm install webxtileOr install directly from the local source tree:
npm install ./deps/webxtile/jsDocumentation
Full API reference with algorithms →
Quick start
import { WebxtileLoader } from "webxtile";
const loader = new WebxtileLoader("https://example.com/tiles");
await loader.open(); // fetches metadata.msgpack
// Load tiles at level 3 for a 2-D bounding box
const result = await loader.loadBBox([500000, 6200000, 520000, 6220000], 3);
// Iterate GPU-sized sub-tiles for rendering
for (const st of result.subTiles()) {
// st.spatial_coords — { x: Float64Array, y: Float64Array, … }
// st.variables — { resistivity: Float32Array, … }
}
// Background: stream all leaf tiles (full resolution, whole dataset)
const ac = new AbortController();
for await (const tile of loader.streamLeaves({ signal: ac.signal })) {
myTileCache.add(tile);
}API summary
| Method / property | Description |
|---|---|
| new WebxtileLoader(baseUrl, [options]) | Create a loader for a tile directory. |
| loader.open() | Fetch metadata.msgpack and open IndexedDB cache. Must be awaited first. |
| loader.meta | Decoded metadata (spatial_dims, crs, var_meta, …). |
| loader.loadBBox(bbox, level) | Load tiles intersecting bbox at octree depth level. |
| loader.streamLeaves([options]) | Async generator — yields all leaf tiles in BFS order. Pauses while loadBBox is in flight. |
| loader.clearCache() | Evict all tiles from in-memory cache and IndexedDB. |
| result.subTiles() | Iterate GPU-sized sub-tiles; each has spatial_coords (1-D arrays) and variables (flat arrays). |
| result.getCoord(dim) | Merged sorted coordinate values for one dimension across all tiles. |
See docs/api.md for full parameter descriptions, algorithms, and the concurrency/priority model.
Dependencies
| Package | Purpose |
|---------|---------|
| @msgpack/msgpack | msgpack decoding |
| idb | Promise-based IndexedDB wrapper |
