-
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
“Image stacks” for image properties #4149
Comments
From @jfirebaugh on November 29, 2016 23:48 Can you say more about the rationale for this feature? Why is it useful? |
From @ajashton on November 30, 2016 0:6 Map designer POV: Say I want to make a set of totally custom icons for my map but still take advantage of the Mapbox Streets vector tile maintainer POV: right now adding new values to fields like |
From @1ec5 on November 30, 2016 0:19 Along these lines, a style designer currently needs to jump through a lot of hoops to implement highway shields. The Mapbox Streets source’s {
"id": "road-shields-black",
"type": "symbol",
…
"filter": [
"all",
[
"<=",
"reflen",
6
],
[
"!in",
"shield",
"at-expressway",
"at-motorway",
"at-state-b",
"bg-motorway",
"bg-national",
"ch-main",
"ch-motorway",
"cz-motorway",
"cz-road",
"de-motorway",
"e-road",
"fi-main",
"gr-motorway",
"gr-national",
"hr-motorway",
"hr-state",
"hu-main",
"hu-motorway",
"nz-state",
"pl-expressway",
"pl-motorway",
"pl-national",
"ro-county",
"ro-motorway",
"ro-national",
"rs-motorway",
"rs-state-1b",
"se-main",
"si-expressway",
"si-motorway",
"sk-highway",
"sk-road",
"us-interstate",
"us-interstate-business",
"us-interstate-duplex",
"us-interstate-truck",
"za-metropolitan",
"za-national",
"za-provincial",
"za-regional"
]
],
"layout": {
…
"icon-image": "{shield}-{reflen}",
…
"text-field": "{ref}",
…
},
…
}, And another one like it for shields with white text. This filter has to be kept in sync with the list of possible values. This proposal would simplify that layer dramatically: {
"id": "road-shields-black",
"type": "symbol",
…
"filter": [
"all",
[
"<=",
"reflen",
6
],
[
"has",
"shield"
],
],
"layout": {
…
"icon-image": [
"{shield}-{reflen}-black"
"generic-{reflen}-black"
],
…
"text-field": "{ref}",
…
},
…
}, (This example would require |
From @1ec5 on December 2, 2016 11:8 The implementation for this feature in GL JS would look very similar to the 1ec5-token-selection-104 branch (which is a proposed implementation of #104), but more tightly scoped so that non-image fields are unaffected by the changes. For simplicity’s sake, we’d continue to represent tokens with the |
#5261 proposes an alternative to the image stack syntax that would be integrated into the expression syntax. |
I think #5261 is the way to go, so let's continue discussion there. |
From @1ec5 on November 29, 2016 23:45
The image properties –
background-pattern
,fill-extrusion-pattern
,fill-pattern
,line-pattern
,icon-image
– should accept an array of strings as an alternative to a single string. As withtext-font
’s “font stack”, the renderer should loop over the items of the array, selecting the first value that corresponds to a valid image in the style. Tokens in each item should be evaluated as they are now. Studio would provide a UI foricon-image
very similar to the UI fortext-font
:This is an alternative to the “token-selection” syntax proposed in mapbox/mapbox-gl-style-spec#104 (comment). Unlike the other use cases being discussed in #104, selecting an image is special because it is the evaluated string as a whole that must be tested for validity, not an individual token with the string. Any syntax we eventually introduce for conditionals or token defaults would coexist with the image stack syntax.
/cc @mapbox/cartography-cats @mapbox/gl
Copied from original issue: mapbox/mapbox-gl-style-spec#597
The text was updated successfully, but these errors were encountered: