-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow tokens in combination with data-driven values? #4484
Comments
/cc @mapbox/gl |
@jfirebaugh @anandthakker if we were to implement tokens in combination with DDS, would it be possible to assign a token as the function's |
Yes, the implementation applies token replacement after function evaluation, and function evaluation includes returning the default value when a value isn't otherwise available. |
Thinking about this further, we actually definitely want to avoid naively composing So in order to support tokens in combination with data-driven values, token replacement would need to be intertwined with function evaluation, so that replacement happens for strings literally contained in the function definition (including These complications push my moral compass further toward the feeling that supporting this would be a mistake. |
Closing per above. (And expressions are the future anyway! 😎) |
From #4074 (review):
Just as a point of discussion I wanted to surface a few examples (based on our Mapbox styles) where tokens + DDS would be useful:
State labels
text-field
values{abbr}
) to the full name (name_en
) at different zoom levelsRail labels
text-field
values""
toname_en
at a certain zoom level. Would be useful if heavy rail stations could switch at an earlier zoom level than light rail and metro stations.Basically, these are situations where one might want to switch from either empty values or different data fields in a hierarchical manner across zoom levels.
These are not critical examples, since they can be separated out into different layers as necessary. I think token fallbacks and arbitrary functions are both more critical, and I agree with @jfirebaugh that we don't want to further block the development of these features. But since tokens + DDS can be useful, perhaps it is worthwhile to get more clarification beyond that one PR comment as to the implications of enabling tokens + DDS for
text-field
andicon-image
?/cc @anandthakker
The text was updated successfully, but these errors were encountered: