UMN-LATIS / leaflet-treering

Use link below to test non-released changes.
https://umn-latis.github.io/leaflet-treering/
0 stars 1 forks source link

Print/download screenshot of leaflet window #68

Open dendrodan opened 4 years ago

dendrodan commented 4 years ago

It would be quite handy to have a button to print the extents of the leaflet window (image, point and paths, text banners, scale bar, all that is visible) to an image (.png, .jpeg, etc.).

Ideas for the downloaded image filename: include asset name at a minimum. Probably good for a popup dialogue box to appear so that the user can add text to the filename string (year and/or feature of interest). Maybe a timestamp (yyyymmddhhmmss)?

For example the default filename might be: "MRG01B_|.png" with the "|" being the location where the cursor would appear by default in the popup dialogue box for the user to append any specific information.

Back when I used to do photomicrographs for presentations and pubs, I would always include the calendar year dates for the first and last ring visible in the picture. We could suggest this to the end user. I'm guessing that automated extraction of years for the first and last points visible in the leaflet window would be impossible?

cmcfadden commented 4 years ago

When we think about implementing this- this is a case where we could potentially use a leaflet plugin, or just learn from what they do. This one is pretty readable - basically makes a new canvas, redraws all the leaflet content into it, then saves a copy to a blob which can be saved locally. Advantage is the saved image can have more resolution than the on screen image (though we’d need to test how our tiles work with that): https://github.com/pasichnykvasyl/Leaflet.BigImage/blob/master/src/Leaflet.BigImage.js

cmcfadden commented 4 years ago

Also to Dan’s question - this export basically means we’re doing arbitrary drawing, so we could add whatever overlays we want in that process (assuming we roll the code into treering)

dendrodan commented 3 years ago

Looking forward to returning to this. I suppose we'll want to allow the user to print screen with the GL slider levels?