SpatiaLite for WASI
v5.1.0WASISpatiaLite 5.1.0 for command-line programs under wasmtime, precompiled for wasm32-wasip3, single-threaded as @crossbind/port-spatialite-wasi.
Install
A spatial SQL command-line tool
WASI has no JavaScript bindings: the program is a main() that links SpatiaLite with SQLite, GEOS and PROJ, built into one .wasm and run with wasmtime. It runs SQL against a database file in the current directory and prints geometries as WKT, and the file it writes opens in QGIS and GDAL. ST_Transform reads PROJ's proj.db, which the build copies to dist/data/proj: the second --dir flag mounts that folder and PROJ_DATA tells PROJ where it is.
What is different on WASI
- There are no JavaScript bindings:
src/nativeprovidesmain(int, char**), and the build is a single.wasm. - Files come from the host through
--dirpreopens;--dir=.gives the program the current directory. crossbind build -p wasi -e wasi -b releasewrites the program to.crossbind/build/<name>-wasi-wasm32-st-release.wasm.- WASI 0.3's
wasi:cli/exitcarries success or failure only, so any non-zero return frommainreaches the shell as exit code 1. - The build runs in the crossbind Docker image, or under
RUNNER=LOCALwith wasi-sdk 34 or newer (WASI_SDK_PATH); running needs wasmtime 47 or newer. See WASI.
Other platforms
- SpatiaLite overview: the apps, every platform's setup and the packages.
- SpatiaLite for WebAssembly: browsers, Node.js and edge runtimes.
- SpatiaLite for Android: React Native apps on Android.
- SpatiaLite for iOS: React Native apps on iOS.
- SpatiaLite for macOS: native Node.js addons and Electron on macOS.
- SpatiaLite for Linux: native Node.js addons on Linux.
- SpatiaLite for Windows: native Node.js addons on Windows.
Facts on this page come from the port manifests in the repository and from what npm served on beta when the site was built. See the Libraries guide for the full consumer flow.