More new feature requests :) -- synced maps and save static image button
Requesting some other new features that seem implementable in maplibre/mapbox js gl!
- Synced maps! To parallel implementation for leaflet in, i.e.,
leafsync::sync. - Add button to save static image of maps with some defaults and option to hide map controls (a leaflet parallel would be
leaflet.extras2::addEasyprint).
Thanks for the "before_id" addition based on the other issue :) this is getting cool, fast.
I think all of those will be possible at some point. The compare() function (tracking in #1) does sync maps, but doesn't show them side-by-side; I'll probably try at some point to include an option to swipe between maps or sync them.
The print button is a little trickier as I'd need to code that from scratch; I don't see a plugin for it. But it'd be useful to have at some point!
Are there any updates on image saving? I have recoded an application we host to do all of its mapping in mapgl, but I'm not going to be able to deploy it without having some way for individuals to download images of the map. I wonder if it is possible to co-opt the orca() function from plotly to do this?
Are there any updates on image saving? I have recoded an application we host to do all of its mapping in
mapgl, but I'm not going to be able to deploy it without having some way for individuals to download images of the map. I wonder if it is possible to co-opt theorca()function fromplotlyto do this?
Actually, I believe I have solved this. By passing the parameter, preserveDrawingBuffer = TRUE to the mapboxgl() function, I was able to download images of the map using the capture() package. I have not tried it with any others yet (e.g. shinyscreenshot()).
Just to update, this also works with the shinyscreenshot package, but there seems to be a little loss of fidelity (some pixels missing) and it places the image on a white background even when there is no background on the map. I'm not sure if this is typical of shinyscreenshot or not because I don't generally use this package.
With capture
With shinyscreenshot
Thanks! I like the look of capture(). I wonder if something similar to this could be integrated into the package with a print button.
Probably. They're just using html2canvas. There are a handful of functions like that on GitHub. But the key is the preserveDrawingBuffer so that the graphics layer renders.
Sent via the Samsung Galaxy S22 Ultra 5G, an AT&T 5G smartphone Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Kyle Walker @.> Sent: Saturday, September 21, 2024 1:20:39 PM To: walkerke/mapgl @.> Cc: CIO Data @.>; Comment @.> Subject: Re: [walkerke/mapgl] More new feature requests :) -- synced maps and save static image button (Issue #11)
CAUTION: External Sender
Thanks! I like the look of capture(). I wonder if something similar to this could be integrated into the package with a print button.
— Reply to this email directly, view it on GitHubhttps://github.com/walkerke/mapgl/issues/11#issuecomment-2365259249, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AV63ITZ327BXCACNQ2QVYQTZXWTGPAVCNFSM6AAAAABKKGTBA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRVGI2TSMRUHE. You are receiving this because you commented.Message ID: @.***>
As an update, I recently switched to using maplibre instead of Mapbox GL in a dashboard. You have to make a slight change to the way you download static images with maplibre. Instead of just putting preserveDrawingBuffer = True in the maplibre() function, you have to add the following:
canvasContextAttributes = list(
preserveDrawingBuffer = T
)