Create a map screenshot

How can I generate a div image, div contains a leaflet map (base layers, overlays)?

Screenshot_Leaflet_Div

+5
source share
2 answers

Mapbox leaflet-image plugin allows you to throw out the image file of your client-container card. You need to use canvas mode, as seen in their instructions. A more attractive server-side approach would include the use of Mapfish / Geoserver and an elevator poster , which has much more flexibility, but also a lot more configuration.

+1
source

In the project, I launched the api nodejs rest API, which launches a chromium instance using puppeteer, takes a screenshot of the map using long lat, and then returns the image as base64. Perhaps it would be more efficient to generate a server-side image of the map using a flyer or something else rather than taking a screenshot of the browser.

https://github.com/lastlink/re-store/tree/master/webscraper

0
source

Source: https://habr.com/ru/post/1233099/


All Articles