iconImage does not work with ["get", "image"] expression if image attribute is the uri
See original GitHub issueDescribe the bug
I need to load iconImage from uri that stored in feature properties.
It works fine If I pass an uri directly to iconImage attribute, like this
iconImage: 'http://my.server.com/images/image1.jpg'
But it does not work if I try to get uri from attribute:
iconImage: ['get', 'iconUri']
I also tried to use image expression but it seems not implemented
iconImage: ['image', ['get', 'iconUri']]
To Reproduce Create a ShapeSource with SymbollLayer
const markers = {
type: "FeatureCollection",
features: [{
geometry: {
type: "Point",
coordinates: [37.6090439796016, 55.7199091654129],
},
type: "Feature",
properties: {
iconUri: 'http://my.server.com/images/image1.jpg',
}
}]
};
const layerStyles = {
imageLevel1: {
iconImage: ['get', 'iconUri'],
iconSize: 0.8,
iconAllowOverlap: true,
iconIgnorePlacement: true,
},
};
<MapboxGL.ShapeSource
id='allMarkers'
onPress={this.onPressMarker}
shape={markers}
>
<MapboxGL.SymbolLayer
id="imagesInMarkersLevel1'
filter={['==', 'isRecommended', 1]}
style={layerStyles.imageLevel1}
/>
</MapboxGL.ShapeSource>
Expected behavior Image is visible
Versions (please complete the following information):
- Platform: Android
- Device: Mi 9 SE
- Emulator/ Simulator: yes
- OS: Android 9
- SDK Version: 28
- React Native Version: 0.61.5
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
iconImage does not work with ["get", "image"] expression if ...
Describe the bug I need to load iconImage from uri that stored in feature properties. It works fine If I pass an uri...
Read more >react-native mapbox symbol layer render icons from URI ...
In react-native-mapbox-gl 7.0 if iconImage is constant then you can use url -s. But if it's an expression it should be a key...
Read more >Solved: Add Image to Attribute Expression - Esri Community
I want the text to be follow by a specific image based on the field value. I can get the text to change...
Read more >Images in Xamarin.Forms - Microsoft Learn
IconImageSource property can't be populated from an image in an asset catalog image set. Instead, load icon images for the Page.IconImageSource ...
Read more >ImageIcon (Java Platform SE 8 ) - Oracle Help Center
Warning: Serialized objects of this class will not be compatible with future ... If the image has a "comment" property that is a...
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
If I’m not mistaken fetching images from a url is also not available from the mapbox style spec of iconImage. The image has to come from the map sprite or added images.
done #813