diff --git a/packages/config-loader/src/json/parse.style.ts b/packages/config-loader/src/json/parse.style.ts index 8ea4bb828..b26155dd0 100644 --- a/packages/config-loader/src/json/parse.style.ts +++ b/packages/config-loader/src/json/parse.style.ts @@ -11,6 +11,7 @@ export const zStyleJson = z.object({ // TODO it would be good to actually validate all the styles layers: z.array(z.unknown()), + sky: z.unknown(), }); export type StyleJsonConfigSchema = z.infer; diff --git a/packages/config/src/config/vector.style.ts b/packages/config/src/config/vector.style.ts index d1fc92958..d39618c8b 100644 --- a/packages/config/src/config/vector.style.ts +++ b/packages/config/src/config/vector.style.ts @@ -40,6 +40,24 @@ export interface Layer { 'source-layer'?: string; } +/** Sky MapLibre Style Spec, all valuables support interpolate expressions, as unknown format */ +export interface Sky { + /** The base color for the sky. Optional Defaults to #88C6FC */ + 'sky-color'?: string | unknown[]; + /** The base color at the horizon. Optional Defaults to #ffffff */ + 'horizon-color'?: string | unknown[]; + /** The base color for the fog. Requires 3D terrain. Optional Defaults to #ffffff */ + 'fog-color'?: string | unknown[]; + /** How to blend the fog over the 3D terrain. Optional number in range [0, 1]. Defaults to 0.5 */ + 'fog-ground-blend'?: number | unknown[]; + /** How to blend the fog color and the horizon color. Optional number in range [0, 1]. Defaults to 0.8. */ + 'horizon-fog-blend'?: number | unknown[]; + /** How to blend the the sky color and the horizon color. Optional number in range [0, 1]. Defaults to 0.8. */ + 'sky-horizon-blend'?: number | unknown[]; + /** How to blend the atmosphere. Optional number in range [0, 1]. Defaults to 0.8. */ + 'atmosphere-blend'?: number | unknown[]; +} + export interface Terrain { source: string; exaggeration: number; @@ -73,6 +91,9 @@ export interface StyleJson { /** Layers will be drawn in the order of this array. */ layers: Layer[]; + /** The map's sky configuration */ + sky?: Sky; + /** OPTIONAL - A global modifier that elevates layers and markers based on a DEM data source */ terrain?: Terrain; } diff --git a/packages/lambda-tiler/src/routes/tile.style.json.ts b/packages/lambda-tiler/src/routes/tile.style.json.ts index 6178e9e4b..becc18e1d 100644 --- a/packages/lambda-tiler/src/routes/tile.style.json.ts +++ b/packages/lambda-tiler/src/routes/tile.style.json.ts @@ -70,6 +70,7 @@ export function convertStyleJson( if (style.metadata) styleJson.metadata = style.metadata; if (style.glyphs) styleJson.glyphs = convertRelativeUrl(style.glyphs, undefined, undefined, config); if (style.sprite) styleJson.sprite = convertRelativeUrl(style.sprite, undefined, undefined, config); + if (style.sky) styleJson.sky = style.sky; return styleJson; }