larsmaxfield / maplibre-gl-js

MapLibre GL JS - Interactive vector tile maps in WebGL2
https://maplibre.org/maplibre-gl-js/docs/
Other
0 stars 0 forks source link

Determine how best to add ElevationLayerSpecification #5

Closed larsmaxfield closed 3 months ago

larsmaxfield commented 3 months ago

Right now ElevationLayerSpecification is manually added to node_modules/@maplibre/maplibre-gl-style-spec/dist/index.d.ts as a copy of HillshadeLayerSpecification with property "type": "elevation" for the switch-case in painter.ts/renderLayer to call drawElevation:

Line 927:

export type ElevationLayerSpecification = {
    "id": string;
    "type": "elevation";
    "metadata"?: unknown;
    "source": string;
    "source-layer"?: string;
    "minzoom"?: number;
    "maxzoom"?: number;
    "filter"?: FilterSpecification;
    "layout"?: {
        "visibility"?: "visible" | "none";
    };
    "paint"?: {
        "hillshade-illumination-direction"?: PropertyValueSpecification<number>;
        "hillshade-illumination-anchor"?: PropertyValueSpecification<"map" | "viewport">;
        "hillshade-exaggeration"?: PropertyValueSpecification<number>;
        "hillshade-shadow-color"?: PropertyValueSpecification<ColorSpecification>;
        "hillshade-highlight-color"?: PropertyValueSpecification<ColorSpecification>;
        "hillshade-accent-color"?: PropertyValueSpecification<ColorSpecification>;
    };
};

Line 963*:

... | ElevationLayerSpecification ...

Possible options:

larsmaxfield commented 3 months ago

Solution: