maplibre-gl-export : How to get the generated image for creating pdf from other component of the application

181 Views Asked by At

Using maplibre-gl-export plugin for exporting map, I'm looking for a way to get and pass the generated image to other component of my react application? I am able to invoke the click function for generate-button, but not able to get the resultant image. Thank you

1

There are 1 best solutions below

0
Malcolm On

If all you want is the map image this is the simplest way:

const mapCanvasDataURL = map.getCanvas().toDataURL();