MapTiler plugin can convert any style.json containing GL JS style definition. However, the plugin does not support all of the style definition expressions. This article covers which expressions are supported and which are not.
Filter expression
Filter expression defines which features will be affected by a specific style layer definition.
Combining filters
all, any, none
Existential filters
has, !has
match, get
Set membership filters
in, !in
Comparison filters
!, ==, !=, >=, >, <=, <
Zoom function
zoom function changes a property of a style layer based on zoom level. Value must be literal values (i.e. not functions or expressions), and appropriate for the property. For example, stop output values for a fill-color
function property must be colors.
{ "base":1, "stops": [ [zoom1, value1], [zoom2, value2], [zoom3, value3] ] }
Interpolation
[ "interpolate", [method] // options: ["linear"], ["exponential", base] ["zoom"], zoom1, value1, zoom2, value2, zoom3, value3 ]
Cubic-bezier
interpolation is not supported.
Step
[
"step",
input, // e.g. ["get", "attribute"] or ["zoom"]
step_input_0, step_output_0,
stop_input_1, stop_output_1,
stop_input_n, stop_output_n,
...
]
Just one-level nested expressions in the interpolation function are supported. E.g.
"line-color": ["interpolate", ["linear"], ["zoom"], 10, "rgba(138, 195, 229, 1)", 16, [ "match", ["get", "class"], ["river","canal"], "rgba(160, 205, 236, 1)", "rgba(140, 185, 226, 1)" ] ]
Paint-properties
Fill
fill-color
Can be defined as a static value (string, hsl, hsla, RGB, rgba), using zoom function or interpolation.
fill-outline-color
Can be defined as a static value (string, hsl, hsla, RGB, rgba), using zoom function or interpolation.
fill-opacity
Can be defined as a static value, using zoom function or interpolation.
If opacity is already set in color as alpha channel, this property is skipped.
fill-translate
Can be defined as a static array or using zoom function.
fill-pattern
Can be defined as a string or using zoom function
Line
line-color
Can be defined as a static value (string, hsl, hsla, RGB, rgba), using zoom function or interpolation.
line-width
Can be defined as a static value, using zoom function or interpolation.
line-offset
Can be defined as a static value, using zoom function or interpolation.
line-opacity
Can be defined as a static value, using zoom function or interpolation.
line-dasharray
Can be defined as a static array or using zoom function.
line-cap
Can be round
, square
or flat
(default).
line-join
Can be bevel
, round
or miter
(default).
Labels
text-field
Can be defined as a static string, expression, list of expression or using zoom function.
text-size
Can be defined as a static value, using zoom function or interpolation.
text-max-width
Can be defined as a static value, using zoom function or interpolation.
text-letter-spacing
Can be defined as a static value, using zoom function or interpolation.
text-font
Can be defined as a static value (string), list of string or zoom function.
If font not found on your system, the plugin will try to use fallback fonts: Open Sans Regular
, Arial Unicode MS
text-color
Can be defined as a static value (string, hsl, hsla, RGB, rgba), using zoom function or interpolation.
text-halo-color
Can be defined as a static value (string, hsl, hsla, RGB, rgba), using zoom function or interpolation.
text-halo-width
Can be defined as a static value (string, hsl, hsla, RGB, rgba), using zoom function or interpolation.
text-halo-blur
Must be defined as a static value.
text-transform
Must be uppercase
or lowercase
.
text-offset
Can be defined as a static array or using zoom function.
text-justify
Must be one of the following: left
, right
, follow
, center
(default).
text-anchor
Must be one of the following: center
(default), left
, right
, top
, bottom
, top-left
, top-right
, bottom-left
, bottom-right
.
icon-image
Can be defined as a static string or using zoom function.
Background
background-color
Can be defined as a static value(string, hsl, hsla, RGB, rgba) or zoom function.
background-opacity
Can be defined as a static value or zoom function.
Useful links:
https://docs.mapbox.com/mapbox-gl-js/style-spec/expressions/
https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/
Comments
0 comments
Please sign in to leave a comment.