react-leaflet-map-screenshot
v1.0.7
Published
Hook for use with react-leaflet to take screenshots of the map
Downloads
131
Readme
react-leaflet-map-screenshot
React Leaflet hook which takes a screenshot of a Leaflet map. Uses html-to-image.
This is influenced by leaflet-simple-map-screenshoter, in fact it takes a couple of things directly from it - waiting for interactions to finish and an array of elements to hide before taking a screenshot.
I had some issues with that addon, although I think it was mainly with dom-to-image
which it used. I have created this to simplify further the process of capturing a leaflet map as a screenshot, but also using more recent libraries.
Install
npm install react-leaflet-map-screenshot --save
Usage
import useMapScreenshot from 'react-leaflet-map-screenshot'
const screenshoter = useMapScreenshot()
const screenshot = await screenshoter.takeScreenshot('png')