XYZ Maps Documentation
    Preparing search index...

    Interface ModelStyleExperimental

    Interface for configuring the visual appearance of Models. The default orientation is with the Y axis pointing up.

    For Point features, a non-degenerate 2D WGS84 feature.bbox ([west, south, east, north], with west < east or south < north) declares explicit model coverage. The Point coordinates remain the model anchor. For Polygon and MultiPolygon features, the footprint's bounding box supplies coverage automatically; the existing polygon center remains the model anchor. A MultiPolygon places one model per feature, not one per component. Each intersecting tile renders and picks only its slice of the model. Bounds must cover the complete transformed geometry, including scale, translation and rotation, at every applicable zoom level. Antimeridian-crossing bounds are not supported. Without such bounds the anchor-tile behavior is unchanged. Other Point styles and Terrain styles do not use these coverage semantics.

    Coverage does not guarantee discovery of remote features: the provider/server must deliver the feature before its coverage can be indexed locally. Coverage also does not expand the viewport's tile candidate grid by model height. At high pitch, elevated geometry whose ground footprint lies outside that grid can remain unavailable even when its top would project into the viewport. Coverage is not supported with altitude: 'terrain': these models retain anchor-tile rendering and picking. Use an explicit altitude for coverage across tiles; sampling separate tile heightmaps at an out-of-tile anchor would otherwise produce inconsistent elevations between slices.

    interface ModelStyle {
        alphaCutoff?: number;
        alphaMode?: ModelAlphaMode;
        anchor?:
            | "Centroid"
            | "Center"
            | [number, number]
            | StyleZoomRange<"Centroid" | "Center" | [number, number]>
            | StyleValueFunction<"Centroid" | "Center" | [number, number]>
            | StyleExpression<"Centroid" | "Center" | [number, number]>;
        cullFace?: false | "Front" | "Back";
        emissive?:
            | Color
            | StyleZoomRange<Color>
            | StyleExpression<Color>
            | StyleValueFunction<Color>;
        light?: string;
        materialOverrides?: { [materialName: string]: ModelMaterialOverride };
        model: ModelSource | StyleValueFunction<ModelSource>;
        modelId?: number;
        rotate?: number[];
        scale?: number[];
        shininess?: number;
        specular?:
            | Color
            | StyleZoomRange<Color>
            | StyleExpression<Color>
            | StyleValueFunction<Color>;
        transform?: number[];
        translate?: number[];
        type: "Model";
        zIndex:
            | number
            | StyleValueFunction<number>
            | StyleZoomRange<number>
            | StyleExpression<number>;
        zLayer?: number | StyleValueFunction<number> | StyleExpression<number>;
    }
    Index
    alphaCutoff?: number

    Alpha threshold for masked materials.

    0.5
    
    alphaMode?: ModelAlphaMode

    Alpha mode override applied to all materials in this model. In auto mode, material opacity and MTL opacity maps are used to infer blending. The alpha channel in a diffuse texture alone is ambiguous and does not change the mode. See ModelAlphaMode for the current blending and sorting limitations.

    'auto'
    
    anchor?:
        | "Centroid"
        | "Center"
        | [number, number]
        | StyleZoomRange<"Centroid" | "Center" | [number, number]>
        | StyleValueFunction<"Centroid" | "Center" | [number, number]>
        | StyleExpression<"Centroid" | "Center" | [number, number]>

    Places the model origin on a Polygon or MultiPolygon. Defaults to "Center" (the projected bounding-box center); "Centroid" uses the geometric centroid. A coordinate is a WGS84 [longitude, latitude] pair in degrees, not pixels.

    This placement is independent of model rotation, scale, transform and local translate. Point geometries keep their own coordinates. The feature footprint, tile coverage and terrain coverage are unchanged; moving the origin does not expand coverage beyond the feature bounds. Zoom-map stops are rounded to integers and prepared for integer zooms 1–20, like other style zoom maps. They select the last reached stop, using the first below the stop range and the last above it within those supported zooms. Values (including coordinates) are not interpolated.

    anchor: f => f.properties.anchorCoordinate ?? 'Center'
    
    cullFace?: false | "Front" | "Back"

    Selects which faces are discarded: "Front" discards front faces, "Back" discards back faces. Front faces use counter-clockwise vertex winding in model coordinates. Set to false to render both sides. Face culling is disabled by default.

    @defaultValue: false

    emissive?:
        | Color
        | StyleZoomRange<Color>
        | StyleExpression<Color>
        | StyleValueFunction<Color>

    Sets the emissive color of the "Model", giving it a glow effect.

    Combination with Material Emissive:

    • The provided emissive color value will be combined with Material.emissive through color addition.

    Color for a detailed list of possible supported formats.

    light?: string

    Specifies the name of the light group to use for illuminating specific features on a layer. This property must reference a key corresponding to a light group defined in LayerStyle.lights. A light group consists of lighting sources such as ambient or directional lights that affect the appearance of features.

    If light is not defined, the default light group "defaultLight" will be used to illuminate the layer's features.

    LayerStyle.lights for defining and referencing available light groups.

    "defaultLight"
    
    materialOverrides?: { [materialName: string]: ModelMaterialOverride }

    Alpha overrides for named materials, keyed by their MTL material names. Per-material values take precedence over the model-wide alpha settings.

    {Transparent: {alphaMode: 'mask', alphaCutoff: 0.5}}
    

    The Model data that should be rendered. In addition to passing the model directly, a string can also be provided that references a Wavefront OBJ file.

    {zIndex: 0, type: "Model", model: "./MyModel.obj"}
    
    {zIndex: 0, type: "Model", model: (feature) => feature.properties.model}

    Inline {@link OBJModelSource} objects are cached by identity. Reuse the same
    object across evaluations and replace it when its contents change.
    modelId?: number
    rotate?: number[]

    rotate the model by the given vector [radX,radY,radZ]. The order of rotation is x first, then y, followed by z.

    scale?: number[]

    Scale the model by the given vector [sx,sy,sz].

    shininess?: number

    Sets the shininess of the "Model", determining how glossy its surface appears. A higher value makes the ``"Model"` surface more reflective.

    Combination with Material Shininess:

    • Effect: The shininess value controls the size and intensity of the specular highlight, which is colored by the specular property.
    • Specular Dependency: The shininess property enhances the effect of the specular color. If specular is not set, shininess has no visible effect.
    • Range: The shininess value typically ranges from 0 to 128.
    • Low Values (0-10): Produce a wide, diffused highlight, resulting in a matte or dull appearance.
    • High Values (50-128): Produce a small, intense highlight, resulting in a glossy or shiny appearance.
    32
    
    specular?:
        | Color
        | StyleZoomRange<Color>
        | StyleExpression<Color>
        | StyleValueFunction<Color>

    Sets the specular color of the "Model", affecting how it reflects light.

    Combination with Material Specular:

    • The provided specular value will be combined with Material.specular through color addition.
    • Effect: The specular property determines the color of the light reflection, while the shininess value controls the intensity and size of the reflection.
    • Shininess Dependency: If specular is set and shininess is not explicitly set, the default shininess value will be used to control the reflection's appearance.

    Color for a detailed list of possible supported formats.

    transform?: number[]

    4x4 transformation matrix to transform the model. if transform is defined, scale, translate and rotate are ignored.

    translate?: number[]

    Translate the model by the given vector [tx,ty,tz].

    type: "Model"

    Specifies the type of style to render.

    zIndex:
        | number
        | StyleValueFunction<number>
        | StyleZoomRange<number>
        | StyleExpression<number>

    Indicates the drawing order within a layer. Styles with larger zIndex value are rendered above those with smaller values. The zIndex is defined relative to the "zLayer" property. If "zLayer" is defined all zIndex values are relative to the "zLayer" value.

    zLayer?: number | StyleValueFunction<number> | StyleExpression<number>

    Indicates drawing order across multiple layers. Styles using zLayer with a high value are rendered on top of zLayers with a low value. If no zLayer is defined, it will fall back to the LayerStyle.zLayer or depend on the display layer order. The first (lowest) layer has a zLayer value of 1.

    {...zLayer: 2, zIndex: 5} will be rendered on top of {...zLayer: 1, zIndex: 10}