tileserver-gl 5.6.0 → 5.7.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/package.json +23 -20
- package/public/resources/maplibre-gl.css +1 -1
- package/public/resources/maplibre-gl.js +4 -4
- package/public/resources/maplibre-gl.js.map +1 -1
- package/src/main.js +9 -0
- package/src/mbtiles_wrapper.js +9 -0
- package/src/metrics.js +70 -0
- package/src/pmtiles_adapter.js +51 -3
- package/src/serve_data.js +47 -4
- package/src/serve_font.js +10 -0
- package/src/serve_rendered.js +150 -23
- package/src/serve_style.js +17 -0
- package/src/server.js +144 -31
- package/src/utils.js +3 -3
- package/test/fixtures/reload-config.json +34 -0
- package/test/fixtures/visual/diffs/static-bearing-pitch-diff.png +0 -0
- package/test/metrics.js +102 -0
- package/test/reload.js +98 -0
- package/test/style.js +36 -0
- package/test/utils/create_terrain_mbtiles.js +16 -11
|
@@ -12,8 +12,10 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
12
12
|
const __dirname = path.dirname(__filename);
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Converts an elevation value to Mapbox RGB encoding.
|
|
16
|
+
* Uses mapbox encoding: elevation = -10000 + (R * 256 * 256 + G * 256 + B) * 0.1
|
|
17
|
+
* @param {number} elevation - The elevation value in meters.
|
|
18
|
+
* @returns {{r: number, g: number, b: number}} The RGB values representing the elevation.
|
|
17
19
|
*/
|
|
18
20
|
function elevationToMapboxRGB(elevation) {
|
|
19
21
|
// elevation = -10000 + (R * 65536 + G * 256 + B) * 0.1
|
|
@@ -26,9 +28,10 @@ function elevationToMapboxRGB(elevation) {
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param tileSize
|
|
31
|
-
* @param elevation
|
|
31
|
+
* Creates a PNG terrain tile filled with a solid color representing the given elevation.
|
|
32
|
+
* @param {number} tileSize - The width and height of the tile in pixels.
|
|
33
|
+
* @param {number} elevation - The elevation value in meters to encode in the tile.
|
|
34
|
+
* @returns {Buffer} A PNG image buffer representing the terrain tile.
|
|
32
35
|
*/
|
|
33
36
|
function createTerrainTile(tileSize, elevation) {
|
|
34
37
|
const canvas = createCanvas(tileSize, tileSize);
|
|
@@ -43,10 +46,11 @@ function createTerrainTile(tileSize, elevation) {
|
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @param db
|
|
48
|
-
* @param sql
|
|
49
|
-
* @param params
|
|
49
|
+
* Runs a SQL statement on a sqlite3 database, returning a promise.
|
|
50
|
+
* @param {object} db - The sqlite3 database instance.
|
|
51
|
+
* @param {string} sql - The SQL statement to execute.
|
|
52
|
+
* @param {Array} params - Parameters to bind to the SQL statement.
|
|
53
|
+
* @returns {Promise<object>} A promise that resolves with the statement context.
|
|
50
54
|
*/
|
|
51
55
|
function runDb(db, sql, params = []) {
|
|
52
56
|
return new Promise((resolve, reject) => {
|
|
@@ -58,8 +62,9 @@ function runDb(db, sql, params = []) {
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @param outputPath
|
|
65
|
+
* Creates a test terrain MBTiles file at the given output path.
|
|
66
|
+
* @param {string} outputPath - The file path where the MBTiles database should be created.
|
|
67
|
+
* @returns {Promise<void>} A promise that resolves when the MBTiles file has been created.
|
|
63
68
|
*/
|
|
64
69
|
async function createTerrainMbtiles(outputPath) {
|
|
65
70
|
const db = new sqlite3.Database(outputPath);
|