I have a Mapbox map that I give the user on the frontend. It has markers automatically placed. I then allow the user to manipulate the map, changing the zoom, pitch, markers, and draw polygons. After the user made changes, I want to be able to export it as a static map.
Looking at the Mapbox api, it looks like I need to supply geojson and marker data to it, as well as the lat/long, bearing, pitch, etc.
However, I am not sure how to serialize a Mapbox, or if I even can. And if I can't do that, then I'd have to individually extract each data field from the Mapbox UI element before calling the Mapbox api to generate a static map. I can can extract most of the data through the viewport when it's changed, but it is unclear if pin data can be extracted. I haven't been able to find anything about this use case in their documentation.
Ultimately my question boils down to 'is it possible to create a static map directly from the Mapbox object, using either the JavaScript SDK or the Mapbox API?
Thanks
I am using Uber's React-Map-GL if that matters.