question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iconImage does not work with ["get", "image"] expression if image attribute is the uri

See original GitHub issue

Describe 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:closed
  • Created 4 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mattijsfcommented, Feb 5, 2020

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.

0reactions
vovka-scommented, Apr 10, 2020

done #813

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found