@csi-foxbyte/cityjson-to-3d-tiles
Version:
A Node.js library that converts CityJSON files into Cesium 3D Tiles—complete with automatic texture atlas packing, Basis compression, three LOD levels, and customizable threading.
43 lines • 1.26 kB
JavaScript
import {rm}from'fs/promises';import {Database}from'sqlite';import r from'sqlite3';async function R(e,t=false){if(t)try{await rm(e);}catch{}const a=new Database({driver:r.Database,filename:e});return await a.open(),await a.exec(`
PRAGMA synchronous = OFF;
PRAGMA journal_mode = OFF;
PRAGMA threads = 2;
PRAGMA temp_store = FILE;
PRAGMA cache_spill = ON;
PRAGMA ignore_check_constraints = ON;
PRAGMA foreign_keys = OFF;
`),t&&(await a.exec(`
CREATE TABLE data(
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
parentIds TEXT NULL,
childrenIds TEXT NULL,
address TEXT,
attributes TEXT,
type TEXT,
bbMinX REAL,
bbMinY REAL,
bbMinZ REAL,
bbMaxX REAL,
bbMaxY REAL,
bbMaxZ REAL,
doc BLOB NULL,
isInstanced INT,
refId TEXT NULL,
transformationMatrix TEXT NULL
) STRICT
`),await a.exec(`
CREATE TABLE instancedData(
id TEXT PRIMARY KEY,
arrayIndex REAL,
filePath TEXT,
srcSRS TEXT,
doc BLOB
) STRICT
`),await a.exec(`
CREATE TABLE textures(
path TEXT PRIMARY KEY,
img BLOB
) STRICT
`)),a}export{R as createDatabase};//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map