SymbolLayer

public struct SymbolLayer : Layer

An icon or a text label.

  • id

    Declaration

    Swift

    public var id: String
  • Declaration

    Swift

    public let type: LayerType
  • Declaration

    Swift

    public var filter: Expression?
  • Declaration

    Swift

    public var source: String?
  • Declaration

    Swift

    public var sourceLayer: String?
  • Declaration

    Swift

    public var minZoom: Double?
  • Declaration

    Swift

    public var maxZoom: Double?
  • Whether this layer is displayed.

    Declaration

    Swift

    public var visibility: Value<Visibility>?
  • If true, the icon will be visible even if it collides with other previously drawn symbols.

    Declaration

    Swift

    public var iconAllowOverlap: Value<Bool>?
  • Part of the icon placed closest to the anchor.

    Declaration

    Swift

    public var iconAnchor: Value<IconAnchor>?
  • If true, other symbols can be visible even if they collide with the icon.

    Declaration

    Swift

    public var iconIgnorePlacement: Value<Bool>?
  • Name of image in sprite to use for drawing an image background.

    Declaration

    Swift

    public var iconImage: Value<ResolvedImage>?
  • If true, the icon may be flipped to prevent it from being rendered upside-down.

    Declaration

    Swift

    public var iconKeepUpright: Value<Bool>?
  • 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.

    Declaration

    Swift

    public var iconOffset: Value<[Double]>?
  • If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.

    Declaration

    Swift

    public var iconOptional: Value<Bool>?
  • Size of the additional area around the icon bounding box used for detecting symbol collisions.

    Declaration

    Swift

    public var iconPadding: Value<Double>?
  • Orientation of icon when map is pitched.

    Declaration

    Swift

    public var iconPitchAlignment: Value<IconPitchAlignment>?
  • Rotates the icon clockwise.

    Declaration

    Swift

    public var iconRotate: Value<Double>?
  • In combination with symbol-placement, determines the rotation behavior of icons.

    Declaration

    Swift

    public var iconRotationAlignment: Value<IconRotationAlignment>?
  • 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.

    Declaration

    Swift

    public var iconSize: Value<Double>?
  • Scales the icon to fit around the associated text.

    Declaration

    Swift

    public var iconTextFit: Value<IconTextFit>?
  • Size of the additional area added to dimensions determined by icon-text-fit, in clockwise order: top, right, bottom, left.

    Declaration

    Swift

    public var iconTextFitPadding: Value<[Double]>?
  • 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 Mapbox GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.

    Declaration

    Swift

    public var symbolAvoidEdges: Value<Bool>?
  • Label placement relative to its geometry.

    Declaration

    Swift

    public var symbolPlacement: Value<SymbolPlacement>?
  • 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.

    Declaration

    Swift

    public var symbolSortKey: Value<Double>?
  • Distance between two symbol anchors.

    Declaration

    Swift

    public var symbolSpacing: Value<Double>?
  • 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.

    Declaration

    Swift

    public var symbolZOrder: Value<SymbolZOrder>?
  • If true, the text will be visible even if it collides with other previously drawn symbols.

    Declaration

    Swift

    public var textAllowOverlap: Value<Bool>?
  • Part of the text placed closest to the anchor.

    Declaration

    Swift

    public var textAnchor: Value<TextAnchor>?
  • 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. SDF images are not supported in formatted text and will be ignored.

    Declaration

    Swift

    public var textField: Value<String>?
  • Font stack to use for displaying text.

    Declaration

    Swift

    public var textFont: Value<[String]>?
  • If true, other symbols can be visible even if they collide with the text.

    Declaration

    Swift

    public var textIgnorePlacement: Value<Bool>?
  • Text justification options.

    Declaration

    Swift

    public var textJustify: Value<TextJustify>?
  • If true, the text may be flipped vertically to prevent it from being rendered upside-down.

    Declaration

    Swift

    public var textKeepUpright: Value<Bool>?
  • Text tracking amount.

    Declaration

    Swift

    public var textLetterSpacing: Value<Double>?
  • Text leading value for multi-line text.

    Declaration

    Swift

    public var textLineHeight: Value<Double>?
  • Maximum angle change between adjacent characters.

    Declaration

    Swift

    public var textMaxAngle: Value<Double>?
  • The maximum line width for text wrapping.

    Declaration

    Swift

    public var textMaxWidth: Value<Double>?
  • 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.

    Declaration

    Swift

    public var textOffset: Value<[Double]>?
  • If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.

    Declaration

    Swift

    public var textOptional: Value<Bool>?
  • Size of the additional area around the text bounding box used for detecting symbol collisions.

    Declaration

    Swift

    public var textPadding: Value<Double>?
  • Orientation of text when map is pitched.

    Declaration

    Swift

    public var textPitchAlignment: Value<TextPitchAlignment>?
  • 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.

    Declaration

    Swift

    public var textRadialOffset: Value<Double>?
  • Rotates the text clockwise.

    Declaration

    Swift

    public var textRotate: Value<Double>?
  • In combination with symbol-placement, determines the rotation behavior of the individual glyphs forming the text.

    Declaration

    Swift

    public var textRotationAlignment: Value<TextRotationAlignment>?
  • Font size.

    Declaration

    Swift

    public var textSize: Value<Double>?
  • Specifies how to capitalize text, similar to the CSS text-transform property.

    Declaration

    Swift

    public var textTransform: Value<TextTransform>?
  • 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.

    Declaration

    Swift

    public var textVariableAnchor: Value<[TextAnchor]>?
  • 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. For symbol with point placement, the order of elements in an array define priority order for the placement of an orientation variant. For symbol with line placement, the default text writing mode is either [‘horizontal’, ‘vertical’] or [‘vertical’, ‘horizontal’], the order doesn’t affect the placement.

    Declaration

    Swift

    public var textWritingMode: Value<[TextWritingMode]>?
  • The color of the icon. This can only be used with SDF icons.

    Declaration

    Swift

    public var iconColor: Value<StyleColor>?
  • Transition options for iconColor.

    Declaration

    Swift

    public var iconColorTransition: StyleTransition?
  • Fade out the halo towards the outside.

    Declaration

    Swift

    public var iconHaloBlur: Value<Double>?
  • Transition options for iconHaloBlur.

    Declaration

    Swift

    public var iconHaloBlurTransition: StyleTransition?
  • The color of the icon’s halo. Icon halos can only be used with SDF icons.

    Declaration

    Swift

    public var iconHaloColor: Value<StyleColor>?
  • Transition options for iconHaloColor.

    Declaration

    Swift

    public var iconHaloColorTransition: StyleTransition?
  • Distance of halo to the icon outline.

    Declaration

    Swift

    public var iconHaloWidth: Value<Double>?
  • Transition options for iconHaloWidth.

    Declaration

    Swift

    public var iconHaloWidthTransition: StyleTransition?
  • The opacity at which the icon will be drawn.

    Declaration

    Swift

    public var iconOpacity: Value<Double>?
  • Transition options for iconOpacity.

    Declaration

    Swift

    public var iconOpacityTransition: StyleTransition?
  • Distance that the icon’s anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

    Declaration

    Swift

    public var iconTranslate: Value<[Double]>?
  • Transition options for iconTranslate.

    Declaration

    Swift

    public var iconTranslateTransition: StyleTransition?
  • Controls the frame of reference for icon-translate.

    Declaration

    Swift

    public var iconTranslateAnchor: Value<IconTranslateAnchor>?
  • The color with which the text will be drawn.

    Declaration

    Swift

    public var textColor: Value<StyleColor>?
  • Transition options for textColor.

    Declaration

    Swift

    public var textColorTransition: StyleTransition?
  • The halo’s fadeout distance towards the outside.

    Declaration

    Swift

    public var textHaloBlur: Value<Double>?
  • Transition options for textHaloBlur.

    Declaration

    Swift

    public var textHaloBlurTransition: StyleTransition?
  • The color of the text’s halo, which helps it stand out from backgrounds.

    Declaration

    Swift

    public var textHaloColor: Value<StyleColor>?
  • Transition options for textHaloColor.

    Declaration

    Swift

    public var textHaloColorTransition: StyleTransition?
  • Distance of halo to the font outline. Max text halo width is ¼ of the font-size.

    Declaration

    Swift

    public var textHaloWidth: Value<Double>?
  • Transition options for textHaloWidth.

    Declaration

    Swift

    public var textHaloWidthTransition: StyleTransition?
  • The opacity at which the text will be drawn.

    Declaration

    Swift

    public var textOpacity: Value<Double>?
  • Transition options for textOpacity.

    Declaration

    Swift

    public var textOpacityTransition: StyleTransition?
  • Distance that the text’s anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

    Declaration

    Swift

    public var textTranslate: Value<[Double]>?
  • Transition options for textTranslate.

    Declaration

    Swift

    public var textTranslateTransition: StyleTransition?
  • Controls the frame of reference for text-translate.

    Declaration

    Swift

    public var textTranslateAnchor: Value<TextTranslateAnchor>?
  • Undocumented

    Declaration

    Swift

    public init(id: String)
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Declaration

    Swift

    public init(from decoder: Decoder) throws