# Symbol Layer
A symbol layer renders map features as icons and/or text. The layer data source should supply point, line or polygon data.
<!-- Text layer -->
<flow-map-layer type="symbol" ...>
text-field: @name;
text-variable-anchor: ['top'];
text-radial-offset: 1.5;
</flow-map-layer>
<!-- Icon layer -->
<flow-map-layer type="symbol" ...>
icon-image: 'star';
icon-allow-overlap: true;
</flow-map-layer>
# Layout Properties
▸ symbol-placement (opens new window)
Optional enum (default: point).
| Value | Description |
|---|---|
point | The label is placed at the point where the geometry is located. |
line | The label is placed along the line of the geometry. Can only be used on LineString and Polygon geometries. |
line-center | The label is placed at the center of the line of the geometry. Can only be used on LineString and Polygon geometries. Note that a single feature in a vector tile may contain multiple line geometries. |
▸ symbol-spacing (opens new window)
Optional number (default: 250): minimum = 1.
▸ symbol-avoid-edges (opens new window)
Optional boolean (default: false).
▸ symbol-sort-key (opens new window)
number.
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.▸ symbol-z-order (opens new window)
Optional enum (default: auto).
| Value | Description |
|---|---|
auto | Sorts symbols by symbol-sort-key if set. Otherwise, sorts symbols by their y-position relative to the viewport if icon-allow-overlap or text-allow-overlap is set to true or icon-ignore-placement or text-ignore-placement is false. |
viewport-y | Sorts symbols by their y-position relative to the viewport if icon-allow-overlap or text-allow-overlap is set to true or icon-ignore-placement or text-ignore-placement is false. |
source | Sorts symbols by symbol-sort-key if set. Otherwise, no sorting is applied; symbols are rendered in the same order as the source data. |
symbol-sort-key.▸ icon-allow-overlap (opens new window)
Optional boolean (default: false).
▸ icon-ignore-placement (opens new window)
Optional boolean (default: false).
▸ icon-optional (opens new window)
Optional boolean (default: false).
▸ icon-rotation-alignment (opens new window)
Optional enum (default: auto).
| Value | Description |
|---|---|
map | When symbol-placement is set to point, aligns icons east-west. When symbol-placement is set to line or line-center, aligns icon x-axes with the line. |
viewport | Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of symbol-placement. |
auto | When symbol-placement is set to point, this is equivalent to viewport. When symbol-placement is set to line or line-center, this is equivalent to map. |
symbol-placement, determines the rotation behavior of icons.▸ icon-size (opens new window)
Optional number (default: 1): minimum = 0.
icon-size. 1 is the original size; 3 triples the size of the image.▸ icon-text-fit (opens new window)
Optional enum (default: none).
| Value | Description |
|---|---|
none | The icon is displayed at its intrinsic aspect ratio. |
width | The icon is scaled in the x-dimension to fit the width of the text. |
height | The icon is scaled in the y-dimension to fit the height of the text. |
both | The icon is scaled in both x- and y-dimensions. |
▸ icon-text-fit-padding (opens new window)
Optional array (default: 0,0,0,0).
icon-text-fit, in clockwise order: top, right, bottom, left.▸ icon-image (opens new window)
resolvedImage.
▸ icon-padding (opens new window)
Optional number (default: 2): minimum = 0.
▸ icon-keep-upright (opens new window)
Optional boolean (default: false).
▸ icon-offset (opens new window)
Optional array (default: 0,0).
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.▸ icon-anchor (opens new window)
Optional enum (default: center).
| Value | Description |
|---|---|
center | The center of the icon is placed closest to the anchor. |
left | The left side of the icon is placed closest to the anchor. |
right | The right side of the icon is placed closest to the anchor. |
top | The top of the icon is placed closest to the anchor. |
bottom | The bottom of the icon is placed closest to the anchor. |
top-left | The top left corner of the icon is placed closest to the anchor. |
top-right | The top right corner of the icon is placed closest to the anchor. |
bottom-left | The bottom left corner of the icon is placed closest to the anchor. |
bottom-right | The bottom right corner of the icon is placed closest to the anchor. |
▸ icon-pitch-alignment (opens new window)
Optional enum (default: auto).
| Value | Description |
|---|---|
map | The icon is aligned to the plane of the map. |
viewport | The icon is aligned to the plane of the viewport. |
auto | Automatically matches the value of icon-rotation-alignment. |
▸ text-pitch-alignment (opens new window)
Optional enum (default: auto).
| Value | Description |
|---|---|
map | The text is aligned to the plane of the map. |
viewport | The text is aligned to the plane of the viewport. |
auto | Automatically matches the value of text-rotation-alignment. |
▸ text-rotation-alignment (opens new window)
Optional enum (default: auto).
| Value | Description |
|---|---|
map | When symbol-placement is set to point, aligns text east-west. When symbol-placement is set to line or line-center, aligns text x-axes with the line. |
viewport | Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of symbol-placement. |
auto | When symbol-placement is set to point, this is equivalent to viewport. When symbol-placement is set to line or line-center, this is equivalent to map. |
symbol-placement, determines the rotation behavior of the individual glyphs forming the text.▸ text-field (opens new window)
Optional formatted (default: ).
string is provided, it will be treated as a formatted with default/inherited formatting options.▸ text-font (opens new window)
Optional array (default: Open Sans Regular,Arial Unicode MS Regular).
▸ text-max-width (opens new window)
Optional number (default: 10): minimum = 0.
▸ text-line-height (opens new window)
Optional number (default: 1.2).
▸ text-justify (opens new window)
Optional enum (default: center).
| Value | Description |
|---|---|
auto | The text is aligned towards the anchor position. |
left | The text is aligned to the left. |
center | The text is centered. |
right | The text is aligned to the right. |
▸ text-radial-offset (opens new window)
Optional number (default: 0).
text-variable-anchor, which defaults to using the two-dimensional text-offset if present.▸ text-variable-anchor (opens new window)
array.
| Value | Description |
|---|---|
center | The center of the text is placed closest to the anchor. |
left | The left side of the text is placed closest to the anchor. |
right | The right side of the text is placed closest to the anchor. |
top | The top of the text is placed closest to the anchor. |
bottom | The bottom of the text is placed closest to the anchor. |
top-left | The top left corner of the text is placed closest to the anchor. |
top-right | The top right corner of the text is placed closest to the anchor. |
bottom-left | The bottom left corner of the text is placed closest to the anchor. |
bottom-right | The bottom right corner of the text is placed closest to the anchor. |
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.▸ text-anchor (opens new window)
Optional enum (default: center).
| Value | Description |
|---|---|
center | The center of the text is placed closest to the anchor. |
left | The left side of the text is placed closest to the anchor. |
right | The right side of the text is placed closest to the anchor. |
top | The top of the text is placed closest to the anchor. |
bottom | The bottom of the text is placed closest to the anchor. |
top-left | The top left corner of the text is placed closest to the anchor. |
top-right | The top right corner of the text is placed closest to the anchor. |
bottom-left | The bottom left corner of the text is placed closest to the anchor. |
bottom-right | The bottom right corner of the text is placed closest to the anchor. |
▸ text-max-angle (opens new window)
Optional number (default: 45).
▸ text-writing-mode (opens new window)
array.
| Value | Description |
|---|---|
horizontal | If a text's language supports horizontal writing mode, symbols with point placement would be laid out horizontally. |
vertical | If a text's language supports vertical writing mode, symbols with point placement would be laid out vertically. |
▸ text-padding (opens new window)
Optional number (default: 2): minimum = 0.
▸ text-keep-upright (opens new window)
Optional boolean (default: true).
▸ text-transform (opens new window)
Optional enum (default: none).
| Value | Description |
|---|---|
none | The text is not altered. |
uppercase | Forces all letters to be displayed in uppercase. |
lowercase | Forces all letters to be displayed in lowercase. |
text-transform property.▸ text-offset (opens new window)
Optional array (default: 0,0).
▸ text-allow-overlap (opens new window)
Optional boolean (default: false).
▸ text-ignore-placement (opens new window)
Optional boolean (default: false).
▸ text-optional (opens new window)
Optional boolean (default: false).
# Paint Properties
▸ icon-opacity (opens new window)
Optional number (default: 1): between 0 and 1 inclusive.
▸ icon-color (opens new window)
Optional color (default: #000000).
▸ icon-halo-color (opens new window)
Optional color (default: rgba(0, 0, 0, 0)).
▸ icon-halo-width (opens new window)
Optional number (default: 0): minimum = 0.
▸ icon-halo-blur (opens new window)
Optional number (default: 0): minimum = 0.
▸ icon-translate (opens new window)
Optional array (default: 0,0).
▸ icon-translate-anchor (opens new window)
Optional enum (default: map).
| Value | Description |
|---|---|
map | Icons are translated relative to the map. |
viewport | Icons are translated relative to the viewport. |
icon-translate.▸ text-opacity (opens new window)
Optional number (default: 1): between 0 and 1 inclusive.
▸ text-color (opens new window)
Optional color (default: #000000).
▸ text-halo-color (opens new window)
Optional color (default: rgba(0, 0, 0, 0)).
▸ text-halo-width (opens new window)
Optional number (default: 0): minimum = 0.
▸ text-halo-blur (opens new window)
Optional number (default: 0): minimum = 0.
▸ text-translate (opens new window)
Optional array (default: 0,0).
▸ text-translate-anchor (opens new window)
Optional enum (default: map).
| Value | Description |
|---|---|
map | The text is translated relative to the map. |
viewport | The text is translated relative to the viewport. |
text-translate.