Replies: 1 comment 1 reply
-
The following sounds like it might help this case in the future: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any way to "get" a style root property in an expression? ie. "name" or a key/value pair in "metadata"? I have a set of layers that I want to reuse in multiple styles, but in some cases I need to use a different color for layer elements depending on the main style it is being used with. Instead of maintaining multiple copies of my common layers, I'd like to have just one copy, and choose the appropriate color in an expression based on some global style value.
line-color: [
"match",
["get", "name"], // or something like ["get", "metadata:key1"]
"Style1",
"rgba(255, 0, 0, 1)",
"Style2",
"rgba(0, 255, 0, 1)",
"rgba(0, 0, 255, 1)"
]
}
Or even better, being able to reference a set of variables defined in the metadata (or a new root variable section), directly in the layer.
line-color: metadata:key1,
having a new root variable section, could also allow these values to be changed at runtime once loaded into map by maplibre. This seems like it would cut down on the need for complex expressions in certain cases, and allow app to change the color of multiple related objects by changing in ONE place instead of each layer.
Beta Was this translation helpful? Give feedback.
All reactions