Import Cesium v1 terrain tiles from a folder into an mbtiles (sqlite3) database, or serve the tiles in an mbtiles database either as TMS or slippy maps.
It was developed to import a folder with 14 million very small terrain tiles (generated by ctb-builder in Cesium v1 height format) into an mbtiles (sqlite3) database, and to serve those terrain tiles from there. In that way, we can also serve the tiles unzipped, which is useful for our HoloLens application, WorldExplorer. However, you could also use it to import other terrain tiles.
BTW a clean and simple SQLite database manager is SQLite Studio.
To install it globally, use:
npm i -g mbtiles-terrain-server
Get the source
git pull https://github.com/TNOCS/mbtiles-terrain-server
cd mbtiles-terrain-server
You can either use yarn or npm to build it:
yarn
yarn build
or
npm install
npm run build
MBtiles-terrain-server
Import Cesium v1 terrain tiles from a folder into an mbtiles (sqlite3)
database, or serve the tiles in an mbtiles database either as TMS or
slippy maps.
It was developed to import a folder with 14 million very small terrain
tiles (in Cesium v1 height format) into an mbtiles (sqlite3) database,
and to serve those terrain tiles from there. In that way, we can also
serve the tiles unzipped, which is useful for our HoloLens application,
WorldExplorer. However, you could also use it to import other terrain tiles.
For example, after running example 3 below, you can get the raw (zipped)
tiles at "host:port/tms/z/x/y.tile" or "host:port/z/x/y.tile" in TMS or
slippy maps format, respectively. Alternatively, at
"host:port/tms/z/x/y.terrain" or "host:port/z/x/y.terrain", you can retreive
the unzipped data.
When importing many files, you may have to run node using the
--max-old-space-size option e.g.
"node --max-old-space-size=4096 dist/cli.js -v -f tms -i c:/tmp/tiles
tiles.sqlite3"
Options
-f, --format String Expected input format, either 'tms' or 'slippy'
(default).
-p, --port Number Port you wish to use. Default is port 8080.
-i, --input String Input folder you wish to import.
-s, --src File name MBtiles file to write or read.
-h, --help Boolean Show this usage instructions.
-c, --cors Boolean Use CORS (default true).
-v, --verbose Boolean Output is verbose.
Examples
01. Create a new SQLite data by $ mbtiles-terrain-server -i ./tiles
importing a folder with terrain ./data/terrain.sqlite3
tiles in slippy map format.
02. Create a new SQLite data by $ mbtiles-terrain-server -f tms -i
importing a folder with terrain ./tiles ./data/terrain.sqlite3
tiles in TMS format.
03. Serve the terrain tiles using $ mbtiles-terrain-server -p 8321
CORS on port 8321. ./data/terrain.sqlite3