SymbolLayer not shown when rendering custom icons
See original GitHub issueI’m trying to add a different pin for each feature’s category like follows, but pins are not visible no matter what I do. I’m surely missing something so let me ask 4 quick questions:
- What am I missing that this code below doesn’t work (at least on Android)?
- Is this the way to go to show custom pins based on the category of the features plus a default pin?
- Is this approach fine in terms of performance when you show many hundred pins on a map?
- Is it a better idea to create a .png image of each pin and use that instead of a
CustomIcon
(which renders at least twoIcon
inside aView
)?
<MapboxGL.ShapeSource shape={this._createGeoJson()}>
// Restaurant category
<MapboxGL.SymbolLayer filter={["==","category", "foo"]}>
<CustomIcon name="foo" color="#ff5c5c" />
</MapboxGL.SymbolLayer>
// Bank category
<MapboxGL.SymbolLayer filter={["==","category", "bar"]}>
<CustomIcon name="bar" color="#159b00" />
</MapboxGL.SymbolLayer>
// Many other SymbolLayers for other categories...
//<MapboxGL.SymbolLayer ...
// Features with no category
<MapboxGL.SymbolLayer filter={["!", ["has", "category"]]}>
<CustomIcon name="default" color="#5c94ff" />
</MapboxGL.SymbolLayer>
</MapboxGL.ShapeSource>
Where CustomIcon
renders the corresponding MaterialCommunityIcons
over a pin-like Image
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
SymbolLayer not shown when rendering custom icons #561
I'm trying to add a different pin for each feature's category like follows, but pins are not visible no matter what I do....
Read more >react-native mapbox symbol layer render icons from URI ...
I need to show custom icons in my places, that icons are loaded from a specific URL dynamically. Here is my code.
Read more >How do I know if the marker symbol layer will be displayed ...
I need to find out whether or not this marker layer will be displayed when rendering for the feature I selected. How can...
Read more >rnmapbox/Lobby - Gitter
SymbolLayer id="exampleIconName" style={styles.icon} /> </MapboxGL. ... custom icons as pins, I'm doing something wrong and pins are not shown on the map.
Read more >Azure Maps Samples
This sample shows how to customize the rendering of the drawing shapes in the drawing manager by accessing the rendering layers using the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We only support png images. You might be able to generate PNG from vector fonts and use that.
That wouldn’t work for me, I need to set some params like the color and icon image from
react-native-vector-icons
.Being able to use your own
<CustomIcon>
to<MapboxGL.Images>
would be nice, there must be a way to avoid having the image exported beforehand as it’s sometimes impossible!Any other idea?