Does anybody know if there is a way to export the current view of a Leaflet map to jpg? The setup is as follows:

Leaflet is hooked up to an Oracle database. Depending on user interaction, various Geojson layers are displayed. I'd like to include a way for the user to export the current view to a static file (jpg or png). The static file should include the basemap.

Any ideas?

  • You can achieve this by rendering the view with a permalink in PhantomJS. – Decio Aug 17 '13 at 21:40
  • Rendering using phantomjs is not perfect I couldn't find a way of stet mining when the page is fully loaded all visible tiles and markers. – user52463 May 21 '15 at 3:43

There is now a plugin for Leaflet that handles this.



Another plugin leaflet-image

The plugin is working well with standard markers, for export leaflet map with special markers you can see export-leaflet-map-to-image

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.