Skip to content

Commit

Permalink
fix(lambda-tiler): Fix the missing LINZ-terrain source for the elevat…
Browse files Browse the repository at this point in the history
…ion layer. (#3302)

### Motivation

Ensure terrain for the tileset that have outputs

### Modifications

Add terrain source for `tileSetOutputToStyle`.

### Verification


![image](https://github.com/linz/basemaps/assets/12163920/78f900e1-bc00-4229-93ab-9540fefc6b98)
  • Loading branch information
Wentao-Kuang authored Jul 1, 2024
1 parent 7d44492 commit ef8b0f3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/lambda-tiler/src/routes/tile.style.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export async function tileSetToStyle(
return response;
}

export function tileSetOutputToStyle(
export async function tileSetOutputToStyle(
req: LambdaHttpRequest<StyleGet>,
tileSet: ConfigTileSetRaster,
tileMatrix: TileMatrixSet,
Expand Down Expand Up @@ -221,6 +221,9 @@ export function tileSetOutputToStyle(
layers,
};

// Ensure elevation for style json config
await ensureTerrain(req, tileMatrix, apiKey, style);

// Add terrain in style
if (terrain) setStyleTerrain(style, terrain);

Expand Down Expand Up @@ -255,8 +258,8 @@ export async function styleJsonGet(req: LambdaHttpRequest<StyleGet>): Promise<La
const tileSet = await config.TileSet.get(config.TileSet.id(styleName));
if (tileSet == null) return NotFound();
if (tileSet.type !== TileSetType.Raster) return NotFound();
if (tileSet.outputs) return tileSetOutputToStyle(req, tileSet, tileMatrix, apiKey, terrain);
else return tileSetToStyle(req, tileSet, tileMatrix, apiKey, terrain);
if (tileSet.outputs) return await tileSetOutputToStyle(req, tileSet, tileMatrix, apiKey, terrain);
else return await tileSetToStyle(req, tileSet, tileMatrix, apiKey, terrain);
}

// Prepare sources and add linz source
Expand Down

0 comments on commit ef8b0f3

Please sign in to comment.