I want to put my own marker in map, but MyImage should be in png. How if I want it to be an svg?
map.loadImage(MyImage, function(error, image) {
if (error) throw error;
map.addImage("custom-marker", image);
});
I want to put my own marker in map, but MyImage should be in png. How if I want it to be an svg?
map.loadImage(MyImage, function(error, image) {
if (error) throw error;
map.addImage("custom-marker", image);
});
SVG is not supported in mapbox, you need to rasterize your SVG
import mySVG from 'foo.svg'
let img = new Image(20,20)
img.onload = ()=>map.addImage('bus', img)
img.src = mySVG
Source: https://github.com/mapbox/mapbox-gl-js/issues/5529#issuecomment-340011876