Execute Spatialite within Node.js
✓ Published0🌍 Public
TThomasG77
Last edited Feb 2, 2024
Created on Feb 2, 2024
This example demonstrates how to execute SpatiaLite spatial operations within a Node.js application using the `sqlite3` database driver in memory. The code initializes a spatial metadata table, creates a point geometry column with EPSG 4326 projection, and adds a spatial index to a `places_spatialite` table. It then inserts a sample point using `GeomFromText` and queries the table with `db.each`, logging the resulting rows. The workflow relies on `db.loadExtension` to load the native `mod_spatialite` library, with the extension path hard-coded for Linux systems.
AI-generated descriptionExecute Spatialite within Node.js
git clone https://gist.github.com/e559fb6f37ed8f8c6d97b6f8b94bf9db.git spatialite-node-sample
cd spatialite-node-sample
npm i
node index.js
ISC Licensed