diff --git a/public/templates/data.tmpl b/public/templates/data.tmpl index 16cebc7..12a8d98 100644 --- a/public/templates/data.tmpl +++ b/public/templates/data.tmpl @@ -9,9 +9,9 @@ - {{^isLight}} + {{^is_light}} - {{/isLight}} + {{/is_light}} {{/use_maplibre}} {{^use_maplibre}} @@ -139,13 +139,13 @@ }) ); - {{^isLight}} + {{^is_light}} map.addControl( new ElevationInfoControl({ url: "{{public_url}}data/{{id}}/elevation/{z}/{x}/{y}" }) ); - {{/isLight}} + {{/is_light}} {{/is_terrain}} {{^is_terrain}} diff --git a/public/templates/index.tmpl b/public/templates/index.tmpl index acf094f..1d3a514 100644 --- a/public/templates/index.tmpl +++ b/public/templates/index.tmpl @@ -124,9 +124,9 @@ {{/is_vector}} {{^is_vector}} View - {{#elevation_link}} + {{#is_terrain}} Preview Terrain - {{/elevation_link}} + {{/is_terrain}} {{/is_vector}} diff --git a/src/server.js b/src/server.js index 3a1016e..468b713 100644 --- a/src/server.js +++ b/src/server.js @@ -571,15 +571,17 @@ async function start(opts) { data.is_vector = tileJSON.format === 'pbf'; if (!data.is_vector) { if ( - (tileJSON.encoding === 'terrarium' || - tileJSON.encoding === 'mapbox') && - !isLight + tileJSON.encoding === 'terrarium' || + tileJSON.encoding === 'mapbox' ) { - data.elevation_link = getTileUrls( - req, - tileJSON.tiles, - `data/${id}/elevation`, - )[0]; + if (!isLight) { + data.elevation_link = getTileUrls( + req, + tileJSON.tiles, + `data/${id}/elevation`, + )[0]; + } + data.is_terrain = true; } if (center) { const centerPx = mercator.px([center[0], center[1]], center[2]); @@ -698,7 +700,7 @@ async function start(opts) { is_terrain: is_terrain, is_terrainrgb: data.tileJSON.encoding === 'mapbox', terrain_encoding: data.tileJSON.encoding, - isLight: isLight, + is_light: isLight, }; });