mapbox-animation icon indicating copy to clipboard operation
mapbox-animation copied to clipboard

Update mapbox gl js dependency to include map.loadImage and map.addImage

Open maudvd opened this issue 7 years ago • 3 comments

I want to change the style of the feature I'm animating. I want to be able to use an image from an URL as the icon-image of my feature on the map.

This is part of my code : this.map.loadImage('./assets/imgs/fleche_nav.png', (error, image) => { this.map.addImage('marker', image); this.map.addLayer({ "id": "vehicle", "type": "symbol", "source": "vehicle", "layout": { "icon-image": "marker" } }); }

With this I get the error : this.map.loadImage is not a function When I take the loadImage and addImage lines away, and use a standard marker icon, it works without any errors.

maudvd avatar May 24 '18 12:05 maudvd

I dont know when I will have time for that. If you do it, you can open a PR.

misterfresh avatar Aug 22 '18 12:08 misterfresh

This functionality should be in the main mapbox-gl distribution, did you ever suggest that? Any hints on what would be required to make this work with the current version (1.x I guess) of mapbox-gl?

exside avatar Jun 29 '19 05:06 exside

I did a PR a while back but they told me it's not the priority. I may do an update but as long as it's not officially supported it means I need to hack the internals of the project. The gist of it is that you need to edit mapbox icon display function to add a third parameter (the next position). Then you need to add a shader that will interpolate current position and next position for the icon.

misterfresh avatar Aug 25 '19 10:08 misterfresh