On this page

Type Alias SymbolLayerSpecification

type SymbolLayerSpecification = {
    filter?: FilterSpecification;
    id: string;
    layout?: {
        "icon-allow-overlap"?: PropertyValueSpecification<boolean>;
        "icon-anchor"?: DataDrivenPropertyValueSpecification<
            | "center"
            | "left"
            | "right"
            | "top"
            | "bottom"
            | "top-left"
            | "top-right"
            | "bottom-left"
            | "bottom-right",
        >;
        "icon-ignore-placement"?: PropertyValueSpecification<boolean>;
        "icon-image"?: DataDrivenPropertyValueSpecification<
            ResolvedImageSpecification,
        >;
        "icon-keep-upright"?: PropertyValueSpecification<boolean>;
        "icon-offset"?: DataDrivenPropertyValueSpecification<[number, number]>;
        "icon-optional"?: PropertyValueSpecification<boolean>;
        "icon-overlap"?: PropertyValueSpecification<
            "never"
            | "always"
            | "cooperative",
        >;
        "icon-padding"?: DataDrivenPropertyValueSpecification<
            PaddingSpecification,
        >;
        "icon-pitch-alignment"?: PropertyValueSpecification<
            "map"
            | "viewport"
            | "auto",
        >;
        "icon-rotate"?: DataDrivenPropertyValueSpecification<number>;
        "icon-rotation-alignment"?: PropertyValueSpecification<
            "map"
            | "viewport"
            | "auto",
        >;
        "icon-size"?: DataDrivenPropertyValueSpecification<number>;
        "icon-text-fit"?: PropertyValueSpecification<
            "none"
            | "width"
            | "height"
            | "both",
        >;
        "icon-text-fit-padding"?: PropertyValueSpecification<
            [number, number, number, number],
        >;
        "symbol-avoid-edges"?: PropertyValueSpecification<boolean>;
        "symbol-placement"?: PropertyValueSpecification<
            "point"
            | "line"
            | "line-center",
        >;
        "symbol-sort-key"?: DataDrivenPropertyValueSpecification<number>;
        "symbol-spacing"?: PropertyValueSpecification<number>;
        "symbol-z-order"?: PropertyValueSpecification<
            "auto"
            | "viewport-y"
            | "source",
        >;
        "text-allow-overlap"?: PropertyValueSpecification<boolean>;
        "text-anchor"?: DataDrivenPropertyValueSpecification<
            | "center"
            | "left"
            | "right"
            | "top"
            | "bottom"
            | "top-left"
            | "top-right"
            | "bottom-left"
            | "bottom-right",
        >;
        "text-field"?: DataDrivenPropertyValueSpecification<
            FormattedSpecification,
        >;
        "text-font"?: DataDrivenPropertyValueSpecification<string[]>;
        "text-ignore-placement"?: PropertyValueSpecification<boolean>;
        "text-justify"?: DataDrivenPropertyValueSpecification<
            "auto"
            | "left"
            | "center"
            | "right",
        >;
        "text-keep-upright"?: PropertyValueSpecification<boolean>;
        "text-letter-spacing"?: DataDrivenPropertyValueSpecification<number>;
        "text-line-height"?: PropertyValueSpecification<number>;
        "text-max-angle"?: PropertyValueSpecification<number>;
        "text-max-width"?: DataDrivenPropertyValueSpecification<number>;
        "text-offset"?: DataDrivenPropertyValueSpecification<[number, number]>;
        "text-optional"?: PropertyValueSpecification<boolean>;
        "text-overlap"?: PropertyValueSpecification<
            "never"
            | "always"
            | "cooperative",
        >;
        "text-padding"?: PropertyValueSpecification<number>;
        "text-pitch-alignment"?: PropertyValueSpecification<
            "map"
            | "viewport"
            | "auto",
        >;
        "text-radial-offset"?: DataDrivenPropertyValueSpecification<number>;
        "text-rotate"?: DataDrivenPropertyValueSpecification<number>;
        "text-rotation-alignment"?: PropertyValueSpecification<
            "map"
            | "viewport"
            | "viewport-glyph"
            | "auto",
        >;
        "text-size"?: DataDrivenPropertyValueSpecification<number>;
        "text-transform"?: DataDrivenPropertyValueSpecification<
            "none"
            | "uppercase"
            | "lowercase",
        >;
        "text-variable-anchor"?: PropertyValueSpecification<
            (
                | "center"
                | "left"
                | "right"
                | "top"
                | "bottom"
                | "top-left"
                | "top-right"
                | "bottom-left"
                | "bottom-right"
            )[],
        >;
        "text-variable-anchor-offset"?: DataDrivenPropertyValueSpecification<
            VariableAnchorOffsetCollectionSpecification,
        >;
        "text-writing-mode"?: PropertyValueSpecification<
            ("horizontal" | "vertical")[],
        >;
        visibility?: VisibilitySpecification;
    };
    maxzoom?: number;
    metadata?: unknown;
    minzoom?: number;
    paint?: {
        "icon-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>;
        "icon-color-transition"?: TransitionSpecification;
        "icon-halo-blur"?: DataDrivenPropertyValueSpecification<number>;
        "icon-halo-blur-transition"?: TransitionSpecification;
        "icon-halo-color"?: DataDrivenPropertyValueSpecification<
            ColorSpecification,
        >;
        "icon-halo-color-transition"?: TransitionSpecification;
        "icon-halo-width"?: DataDrivenPropertyValueSpecification<number>;
        "icon-halo-width-transition"?: TransitionSpecification;
        "icon-opacity"?: DataDrivenPropertyValueSpecification<number>;
        "icon-opacity-transition"?: TransitionSpecification;
        "icon-translate"?: PropertyValueSpecification<[number, number]>;
        "icon-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">;
        "icon-translate-transition"?: TransitionSpecification;
        "text-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>;
        "text-color-transition"?: TransitionSpecification;
        "text-halo-blur"?: DataDrivenPropertyValueSpecification<number>;
        "text-halo-blur-transition"?: TransitionSpecification;
        "text-halo-color"?: DataDrivenPropertyValueSpecification<
            ColorSpecification,
        >;
        "text-halo-color-transition"?: TransitionSpecification;
        "text-halo-width"?: DataDrivenPropertyValueSpecification<number>;
        "text-halo-width-transition"?: TransitionSpecification;
        "text-opacity"?: DataDrivenPropertyValueSpecification<number>;
        "text-opacity-transition"?: TransitionSpecification;
        "text-translate"?: PropertyValueSpecification<[number, number]>;
        "text-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">;
        "text-translate-transition"?: TransitionSpecification;
    };
    source: string;
    "source-layer"?: string;
    type: "symbol";
}
Index

Properties

A expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The feature-state expression is not supported in filter expressions.

id: string

Unique layer name.

layout?: {
    "icon-allow-overlap"?: PropertyValueSpecification<boolean>;
    "icon-anchor"?: DataDrivenPropertyValueSpecification<
        | "center"
        | "left"
        | "right"
        | "top"
        | "bottom"
        | "top-left"
        | "top-right"
        | "bottom-left"
        | "bottom-right",
    >;
    "icon-ignore-placement"?: PropertyValueSpecification<boolean>;
    "icon-image"?: DataDrivenPropertyValueSpecification<
        ResolvedImageSpecification,
    >;
    "icon-keep-upright"?: PropertyValueSpecification<boolean>;
    "icon-offset"?: DataDrivenPropertyValueSpecification<[number, number]>;
    "icon-optional"?: PropertyValueSpecification<boolean>;
    "icon-overlap"?: PropertyValueSpecification<
        "never"
        | "always"
        | "cooperative",
    >;
    "icon-padding"?: DataDrivenPropertyValueSpecification<PaddingSpecification>;
    "icon-pitch-alignment"?: PropertyValueSpecification<
        "map"
        | "viewport"
        | "auto",
    >;
    "icon-rotate"?: DataDrivenPropertyValueSpecification<number>;
    "icon-rotation-alignment"?: PropertyValueSpecification<
        "map"
        | "viewport"
        | "auto",
    >;
    "icon-size"?: DataDrivenPropertyValueSpecification<number>;
    "icon-text-fit"?: PropertyValueSpecification<
        "none"
        | "width"
        | "height"
        | "both",
    >;
    "icon-text-fit-padding"?: PropertyValueSpecification<
        [number, number, number, number],
    >;
    "symbol-avoid-edges"?: PropertyValueSpecification<boolean>;
    "symbol-placement"?: PropertyValueSpecification<
        "point"
        | "line"
        | "line-center",
    >;
    "symbol-sort-key"?: DataDrivenPropertyValueSpecification<number>;
    "symbol-spacing"?: PropertyValueSpecification<number>;
    "symbol-z-order"?: PropertyValueSpecification<
        "auto"
        | "viewport-y"
        | "source",
    >;
    "text-allow-overlap"?: PropertyValueSpecification<boolean>;
    "text-anchor"?: DataDrivenPropertyValueSpecification<
        | "center"
        | "left"
        | "right"
        | "top"
        | "bottom"
        | "top-left"
        | "top-right"
        | "bottom-left"
        | "bottom-right",
    >;
    "text-field"?: DataDrivenPropertyValueSpecification<FormattedSpecification>;
    "text-font"?: DataDrivenPropertyValueSpecification<string[]>;
    "text-ignore-placement"?: PropertyValueSpecification<boolean>;
    "text-justify"?: DataDrivenPropertyValueSpecification<
        "auto"
        | "left"
        | "center"
        | "right",
    >;
    "text-keep-upright"?: PropertyValueSpecification<boolean>;
    "text-letter-spacing"?: DataDrivenPropertyValueSpecification<number>;
    "text-line-height"?: PropertyValueSpecification<number>;
    "text-max-angle"?: PropertyValueSpecification<number>;
    "text-max-width"?: DataDrivenPropertyValueSpecification<number>;
    "text-offset"?: DataDrivenPropertyValueSpecification<[number, number]>;
    "text-optional"?: PropertyValueSpecification<boolean>;
    "text-overlap"?: PropertyValueSpecification<
        "never"
        | "always"
        | "cooperative",
    >;
    "text-padding"?: PropertyValueSpecification<number>;
    "text-pitch-alignment"?: PropertyValueSpecification<
        "map"
        | "viewport"
        | "auto",
    >;
    "text-radial-offset"?: DataDrivenPropertyValueSpecification<number>;
    "text-rotate"?: DataDrivenPropertyValueSpecification<number>;
    "text-rotation-alignment"?: PropertyValueSpecification<
        "map"
        | "viewport"
        | "viewport-glyph"
        | "auto",
    >;
    "text-size"?: DataDrivenPropertyValueSpecification<number>;
    "text-transform"?: DataDrivenPropertyValueSpecification<
        "none"
        | "uppercase"
        | "lowercase",
    >;
    "text-variable-anchor"?: PropertyValueSpecification<
        (
            | "center"
            | "left"
            | "right"
            | "top"
            | "bottom"
            | "top-left"
            | "top-right"
            | "bottom-left"
            | "bottom-right"
        )[],
    >;
    "text-variable-anchor-offset"?: DataDrivenPropertyValueSpecification<
        VariableAnchorOffsetCollectionSpecification,
    >;
    "text-writing-mode"?: PropertyValueSpecification<
        ("horizontal" | "vertical")[],
    >;
    visibility?: VisibilitySpecification;
}

Layout properties for the layer.

Type Declaration

  • Optionalicon-allow-overlap?: PropertyValueSpecification<boolean>

    If true, the icon will be visible even if it collides with other previously drawn symbols.

  • Optionalicon-anchor?: DataDrivenPropertyValueSpecification<
        | "center"
        | "left"
        | "right"
        | "top"
        | "bottom"
        | "top-left"
        | "top-right"
        | "bottom-left"
        | "bottom-right",
    >

    Part of the icon placed closest to the anchor.

    "center"
    
  • Optionalicon-ignore-placement?: PropertyValueSpecification<boolean>

    If true, other symbols can be visible even if they collide with the icon.

  • Optionalicon-image?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>

    Name of image in sprite to use for drawing an image background.

  • Optionalicon-keep-upright?: PropertyValueSpecification<boolean>

    If true, the icon may be flipped to prevent it from being rendered upside-down.

  • Optionalicon-offset?: DataDrivenPropertyValueSpecification<[number, number]>

    Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of icon-size to obtain the final offset in pixels. When combined with icon-rotate the offset will be as if the rotated direction was up.

    [0, 0]
    
  • Optionalicon-optional?: PropertyValueSpecification<boolean>

    If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.

  • Optionalicon-overlap?: PropertyValueSpecification<"never" | "always" | "cooperative">

    Allows for control over whether to show an icon when it overlaps other symbols on the map. If icon-overlap is not set, icon-allow-overlap is used instead.

  • Optionalicon-padding?: DataDrivenPropertyValueSpecification<PaddingSpecification>

    Size of additional area round the icon bounding box used for detecting symbol collisions.

    [2]
    
  • Optionalicon-pitch-alignment?: PropertyValueSpecification<"map" | "viewport" | "auto">

    Orientation of icon when map is pitched.

    "auto"
    
  • Optionalicon-rotate?: DataDrivenPropertyValueSpecification<number>

    Rotates the icon clockwise.

  • Optionalicon-rotation-alignment?: PropertyValueSpecification<"map" | "viewport" | "auto">

    In combination with symbol-placement, determines the rotation behavior of icons.

    "auto"
    
  • Optionalicon-size?: DataDrivenPropertyValueSpecification<number>

    Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by icon-size. 1 is the original size; 3 triples the size of the image.

    1
    
  • Optionalicon-text-fit?: PropertyValueSpecification<"none" | "width" | "height" | "both">

    Scales the icon to fit around the associated text.

    "none"
    
  • Optionalicon-text-fit-padding?: PropertyValueSpecification<[number, number, number, number]>

    Size of the additional area added to dimensions determined by icon-text-fit, in clockwise order: top, right, bottom, left.

    [0, 0, 0, 0]
    
  • Optionalsymbol-avoid-edges?: PropertyValueSpecification<boolean>

    If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like MapLibre GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.

  • Optionalsymbol-placement?: PropertyValueSpecification<"point" | "line" | "line-center">

    Label placement relative to its geometry.

    "point"
    
  • Optionalsymbol-sort-key?: DataDrivenPropertyValueSpecification<number>

    Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When icon-allow-overlap or text-allow-overlap is false, features with a lower sort key will have priority during placement. When icon-allow-overlap or text-allow-overlap is set to true, features with a higher sort key will overlap over features with a lower sort key.

  • Optionalsymbol-spacing?: PropertyValueSpecification<number>

    Distance between two symbol anchors.

    250
    
  • Optionalsymbol-z-order?: PropertyValueSpecification<"auto" | "viewport-y" | "source">

    Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use symbol-sort-key.

    "auto"
    
  • Optionaltext-allow-overlap?: PropertyValueSpecification<boolean>

    If true, the text will be visible even if it collides with other previously drawn symbols.

  • Optionaltext-anchor?: DataDrivenPropertyValueSpecification<
        | "center"
        | "left"
        | "right"
        | "top"
        | "bottom"
        | "top-left"
        | "top-right"
        | "bottom-left"
        | "bottom-right",
    >

    Part of the text placed closest to the anchor.

    "center"
    
  • Optionaltext-field?: DataDrivenPropertyValueSpecification<FormattedSpecification>

    Value to use for a text label. If a plain string is provided, it will be treated as a formatted with default/inherited formatting options.

  • Optionaltext-font?: DataDrivenPropertyValueSpecification<string[]>

    Fonts to use for displaying text. If the glyphs root property is specified, this array is joined together and interpreted as a font stack name. Otherwise, it is interpreted as a cascading fallback list of local font names.

    ["Open Sans Regular", "Arial Unicode MS Regular"]
    
  • Optionaltext-ignore-placement?: PropertyValueSpecification<boolean>

    If true, other symbols can be visible even if they collide with the text.

  • Optionaltext-justify?: DataDrivenPropertyValueSpecification<"auto" | "left" | "center" | "right">

    Text justification options.

    "center"
    
  • Optionaltext-keep-upright?: PropertyValueSpecification<boolean>

    If true, the text may be flipped vertically to prevent it from being rendered upside-down.

    true
    
  • Optionaltext-letter-spacing?: DataDrivenPropertyValueSpecification<number>

    Text tracking amount.

  • Optionaltext-line-height?: PropertyValueSpecification<number>

    Text leading value for multi-line text.

    1.2
    
  • Optionaltext-max-angle?: PropertyValueSpecification<number>

    Maximum angle change between adjacent characters.

    45
    
  • Optionaltext-max-width?: DataDrivenPropertyValueSpecification<number>

    The maximum line width for text wrapping.

    10
    
  • Optionaltext-offset?: DataDrivenPropertyValueSpecification<[number, number]>

    Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. If used with text-variable-anchor, input values will be taken as absolute values. Offsets along the x- and y-axis will be applied automatically based on the anchor position.

    [0, 0]
    
  • Optionaltext-optional?: PropertyValueSpecification<boolean>

    If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.

  • Optionaltext-overlap?: PropertyValueSpecification<"never" | "always" | "cooperative">

    Allows for control over whether to show symbol text when it overlaps other symbols on the map. If text-overlap is not set, text-allow-overlap is used instead

  • Optionaltext-padding?: PropertyValueSpecification<number>

    Size of the additional area around the text bounding box used for detecting symbol collisions.

    2
    
  • Optionaltext-pitch-alignment?: PropertyValueSpecification<"map" | "viewport" | "auto">

    Orientation of text when map is pitched.

    "auto"
    
  • Optionaltext-radial-offset?: DataDrivenPropertyValueSpecification<number>

    Radial offset of text, in the direction of the symbol's anchor. Useful in combination with text-variable-anchor, which defaults to using the two-dimensional text-offset if present.

  • Optionaltext-rotate?: DataDrivenPropertyValueSpecification<number>

    Rotates the text clockwise.

  • Optionaltext-rotation-alignment?: PropertyValueSpecification<"map" | "viewport" | "viewport-glyph" | "auto">

    In combination with symbol-placement, determines the rotation behavior of the individual glyphs forming the text.

    "auto"
    
  • Optionaltext-size?: DataDrivenPropertyValueSpecification<number>

    Font size.

    16
    
  • Optionaltext-transform?: DataDrivenPropertyValueSpecification<"none" | "uppercase" | "lowercase">

    Specifies how to capitalize text, similar to the CSS text-transform property.

    "none"
    
  • Optionaltext-variable-anchor?: PropertyValueSpecification<
        (
            | "center"
            | "left"
            | "right"
            | "top"
            | "bottom"
            | "top-left"
            | "top-right"
            | "bottom-left"
            | "bottom-right"
        )[],
    >

    To increase the chance of placing high-priority labels on the map, you can provide an array of text-anchor locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use text-justify: auto to choose justification based on anchor position. To apply an offset, use the text-radial-offset or the two-dimensional text-offset.

    ["center", "left", "right"]
    
  • Optionaltext-variable-anchor-offset?: DataDrivenPropertyValueSpecification<
        VariableAnchorOffsetCollectionSpecification,
    >

    To increase the chance of placing high-priority labels on the map, you can provide an array of text-anchor locations, each paired with an offset value. The renderer will attempt to place the label at each location, in order, before moving on to the next location+offset. Use text-justify: auto to choose justification based on anchor position.

    The length of the array must be even, and must alternate between enum and point entries. i.e., each anchor location must be accompanied by a point, and that point defines the offset when the corresponding anchor location is used. Positive offset values indicate right and down, while negative values indicate left and up. Anchor locations may repeat, allowing the renderer to try multiple offsets to try and place a label using the same anchor.

    When present, this property takes precedence over text-anchor, text-variable-anchor, text-offset, and text-radial-offset.

    
    { "text-variable-anchor-offset": ["top", [0, 4], "left", [3,0], "bottom", [1, 1]] }
    
    

    When the renderer chooses the top anchor, [0, 4] will be used for text-offset; the text will be shifted down by 4 ems.

    When the renderer chooses the left anchor, [3, 0] will be used for text-offset; the text will be shifted right by 3 ems.

    ["top", [0, 4], "left", [3, 0], "bottom", [1, 1]]
    
  • Optionaltext-writing-mode?: PropertyValueSpecification<("horizontal" | "vertical")[]>

    The property allows control over a symbol's orientation. Note that the property values act as a hint, so that a symbol whose language doesn’t support the provided orientation will be laid out in its natural orientation. Example: English point symbol will be rendered horizontally even if array value contains single 'vertical' enum value. The order of elements in an array define priority order for the placement of an orientation variant.

  • Optionalvisibility?: VisibilitySpecification

    Whether this layer is displayed.

    "visible"
    
maxzoom?: number

The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden.

metadata?: unknown

Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'maplibre:'.

{"source:comment": "Hydrology FCCODE 460 - Narrow wash"}
minzoom?: number

The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden.

paint?: {
    "icon-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>;
    "icon-color-transition"?: TransitionSpecification;
    "icon-halo-blur"?: DataDrivenPropertyValueSpecification<number>;
    "icon-halo-blur-transition"?: TransitionSpecification;
    "icon-halo-color"?: DataDrivenPropertyValueSpecification<
        ColorSpecification,
    >;
    "icon-halo-color-transition"?: TransitionSpecification;
    "icon-halo-width"?: DataDrivenPropertyValueSpecification<number>;
    "icon-halo-width-transition"?: TransitionSpecification;
    "icon-opacity"?: DataDrivenPropertyValueSpecification<number>;
    "icon-opacity-transition"?: TransitionSpecification;
    "icon-translate"?: PropertyValueSpecification<[number, number]>;
    "icon-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">;
    "icon-translate-transition"?: TransitionSpecification;
    "text-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>;
    "text-color-transition"?: TransitionSpecification;
    "text-halo-blur"?: DataDrivenPropertyValueSpecification<number>;
    "text-halo-blur-transition"?: TransitionSpecification;
    "text-halo-color"?: DataDrivenPropertyValueSpecification<
        ColorSpecification,
    >;
    "text-halo-color-transition"?: TransitionSpecification;
    "text-halo-width"?: DataDrivenPropertyValueSpecification<number>;
    "text-halo-width-transition"?: TransitionSpecification;
    "text-opacity"?: DataDrivenPropertyValueSpecification<number>;
    "text-opacity-transition"?: TransitionSpecification;
    "text-translate"?: PropertyValueSpecification<[number, number]>;
    "text-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">;
    "text-translate-transition"?: TransitionSpecification;
}

Default paint properties for this layer.

Type Declaration

source: string

Name of a source description to be used for this layer. Required for all layer types except background.

"source-layer"?: string

Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types, including GeoJSON sources.

type: "symbol"
Was this helpful?
SDK JS
Reference
SymbolLayerSpecification