Mapbox getCanvas().toDataURL() not rendering markers

Viewed 112

I'm trying to obtain a picture of a map using Mapbox. This should be very simple using map.getCanvas().toDataURL(); The catch is that I have markers on my map and these are not present when I obtain the image using the method mentioned above.

This is an example of what I'm experiencing: https://codepen.io/loskiorama/pen/YzeeMqm

Is there any way I could get a "screenshot" of my map that includes the markers? I'm bundling this on a single js file so I can't use solutions like html2canvas as I'd like to keep my file as small as possible.

Thanks!

0 Answers
Related