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
I want to show a complex set of icons: ~100 basetypes with ~30 modifiers. There is no way to predefine ~3000 icons in the PNG sprite and then just pick the right one. I want to define ~130 and combine them freely. That already works by using two independent layers, but then "basetypes" and "modifiers" are on different z-indices so they interfere with each other.
Design Alternatives
Design 1: make "icon-image" accept an array (has to be implemented on other "icon-" options like "icon-offset" as well)
...
"icon-image": ["{basetype}","{modifier}"]...
Design 1a : don´t use an array on every single property but shift it up the to the "paint" and "layout" property.
Design 2: allow the definition of combined icons in the sprite JSON
Advantages Design 1: dynamic styling
Drawbacks Design 1: complex due to multiplication of icon-properties by number of icons
Advantages Design 2: combined icons would show up like normal icons in the stylesheet
Drawbacks Design 2: need for hard coded combined icons
Reacted by Geir Sagberg, Afanasii Kurakin, Angel Lagunas, Jeff deBeer, DoFabien, alex baldwin, Tom Manderson, mllobetWS, Luke Stewart, miloš doubek and 10 more
Expressions open up the door for a different design alternative: some kind of symbol-layout expression that's used to compose icons and runs of text into a single 'rich symbol' that's then treated as a single unit for placement/collision/z-ordering purposes.
Something like:
// new "symbol-content" layer property, incompatible with the "text-field", "icon-image", and "*-{offset,ignore-placement,allow-overlap}" properties"symbol-content": ["symbol-layout",["text",["get","name"],{size: 13,offset: ...,color: ...}],["text",["get","population_density"],{size: 11,offset: ...,color: ...}],["text","ppl / km^2",{size: 11,offset: ...,color: ...}],["icon","dot.sdf",{size: ...,offset: ...,color: ... }],
...
]
Reacted by Jeremy Stratman, alex baldwin, Helen and Albert Moravec
We're making progress on this in #7015, which adds support for multiple fonts/sizes within a single text label. Controlling paint properties (e.g. color) and adding multiple icons will go in later PRs.
The current road name label in the navigation SDK could take advantage of this option to display a route shield alongside a road name in a single point-placed symbol. The iOS implementation uses a native view (mapbox/mapbox-navigation-ios#1576), but runtime styling would be desirable for the Android implementation (mapbox/mapbox-navigation-android#1222) for various reasons, so this feature would allow us to achieve the same effect on both platforms.
Hi guys, I was wondering if there was any update on this feature or any similar one that would enable putting two images over each other in one Symbol layer?
Reacted by Ryan Kendall, Shreyas Parat, AndrzejCzerwoniec-TomTom, Christian Brevik, Anagura, Sabina Hurtado, Luke Stewart, Hanno J. Gödecke, Mathieu Delvaux, Stefan E and 9 more
@shayanaijaz This is not on our roadmap at this time, but we did introduce formatted text with inline image support in v1.6. See this blog post for more details.
If you have a property, you can query it and use it in the layer definition to display different icons:
map.addLayer({
'id': 'bus-layer',
'type': 'symbol',
'source': 'bus-source', // reference the data source
'layout': {
'icon-image': ['get', 'icon'], // reference the icon in properties
'icon-size': 0.2,
}
});
```
See this example over here!
https://docs.mapbox.com/mapbox-gl-js/example/add-image-missing-generated/
Reacted by natallia-ivanchuk
Reacted by Michael Hillman, Michael C Gorman, Matt Gardner, Elliot Clements, Helen and AWilsonORH
Reacted by Stefan Keim, dagmarajuraszczyk-tomtom and Alexandre Girard Davila
Activity
[-]Support Multi-icon symbols or Multi-sprite icons[/-][+]Support multi-icon symbols or multi-sprite icons[/+]1ec5 commentedon Mar 26, 2017
/cc @mapbox/gl
[-]Support multi-icon symbols or multi-sprite icons[/-][+]Support multi-icon/multi-text symbols[/+]jfirebaugh commentedon Nov 22, 2017
Combining this with the very similar #4436. Note the nice example there:
ak0lmak0v commentedon May 2, 2018
is it even possible to realize?
and how many changes need to be done in the render methods?
anandthakker commentedon Jun 27, 2018
Expressions open up the door for a different design alternative: some kind of
symbol-layoutexpression that's used to compose icons and runs of text into a single 'rich symbol' that's then treated as a single unit for placement/collision/z-ordering purposes.Something like:
ChrisLoer commentedon Jul 24, 2018
We're making progress on this in #7015, which adds support for multiple fonts/sizes within a single text label. Controlling paint properties (e.g. color) and adding multiple icons will go in later PRs.
1ec5 commentedon Aug 18, 2018
The current road name label in the navigation SDK could take advantage of this option to display a route shield alongside a road name in a single point-placed symbol. The iOS implementation uses a native view (mapbox/mapbox-navigation-ios#1576), but runtime styling would be desirable for the Android implementation (mapbox/mapbox-navigation-android#1222) for various reasons, so this feature would allow us to achieve the same effect on both platforms.
[-]Support multi-icon/multi-text symbols[/-][+]Support multi-icon symbols[/+]ChrisLoer commentedon Oct 15, 2018
Renaming this to "Support multi-icon symbols" as multi-text has landed on GL JS as #6994 and on GL Native as mapbox/mapbox-gl-native#12624.
Example here: https://www.mapbox.com/mapbox-gl-js/example/display-and-style-rich-text-labels/
Tomcatus commentedon May 18, 2020
Hi guys, I was wondering if there was any update on this feature or any similar one that would enable putting two images over each other in one Symbol layer?
shayanaijaz commentedon Mar 5, 2021
I am also looking for an update on this issue and wondering if this is something that is still being worked on.
asheemmamoowala commentedon Mar 6, 2021
@shayanaijaz This is not on our roadmap at this time, but we did introduce formatted text with inline image support in v1.6. See this blog post for more details.
jasongoodwin commentedon Jan 4, 2022
This is 100% possible with the expression syntax.
If you have a property, you can query it and use it in the layer definition to display different icons: