You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This suggestion relates closely to the substring functionality discussed in #4113, as well as the regex expression support in #4089. I think these existing issues do a better job of addressing the underlying problem (lack of ability to work with substrings in expressions), but this feature request provides another option.
Programming languages commonly implement strings as arrays of characters. Mapbox GL JS expressions could treat strings in the same way to allow for existing expressions (i.e. at) to be used with strings. For example, this would allow filtering for streets whose name property starts with the string "Ba".
Design
If GL JS parsed strings in expressions as arrays, developers could make use of the current at expression to implement the filtering use case described above.
Mock-Up
If a developer wanted to filter for features where the street name property starts with "Ba" , they could set the opacity attribute of the road-label layer to be determined by the following expression:
I actually am finishing up #8876 which implements the in operator which tests both that an element is in an array and that a substring is in a string. This will close #4113
Updating at to work with strings is an interesting idea. I'm not sure there's any other expressions that would really benefit from this behavior.
Motivation
This suggestion relates closely to the substring functionality discussed in #4113, as well as the regex expression support in #4089. I think these existing issues do a better job of addressing the underlying problem (lack of ability to work with substrings in expressions), but this feature request provides another option.
Programming languages commonly implement strings as arrays of characters. Mapbox GL JS expressions could treat strings in the same way to allow for existing expressions (i.e.
at
) to be used with strings. For example, this would allow filtering for streets whose name property starts with the string"Ba"
.Design
If GL JS parsed strings in expressions as arrays, developers could make use of the current
at
expression to implement the filtering use case described above.Mock-Up
If a developer wanted to filter for features where the street name property starts with
"Ba"
, they could set theopacity
attribute of theroad-label
layer to be determined by the following expression:The text was updated successfully, but these errors were encountered: