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.
Our cartographers continuously improve MapTiler map styles. Current styles available in MapTiler Cloud are the 2nd generation (version-2). There isstreets-v2
orbasic-v2
. These styles use advanced style expressions in the style.json definition. Unfortunately, some of these expressions are not supported in the QGIS plugin. All the styles that come with the plugin by default are of version-1 and do not use advanced expressions but work OK in the plugin. The older versions of styles are not listed in MapTiler Cloud, however, they can be accessed like this:
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, usingthe zoom function or interpolation.
If opacity is already set in color asan alpha channel, this property is skipped.
fill-translate
Can be defined as a static array or usinga zoom function.
fill-pattern
Can be defined as a string or usinga 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 a 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
an 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
Vector tile basemaps via QGIS plugin
Mapbox Styles - Expressions
Mapbox Styles - Layers
MapTiler QGIS plugin
Comments
0 comments
Please sign in to leave a comment.