Opening multiple popups simultaneously
Hi, this is a nice, useful a package. Love it. However, I tried to open multiple popups at the same time, and could not get a solution. On https://stackoverflow.com/questions/38957585/how-can-i-open-multiple-popups-in-leaflet-marker-at-a-time there are some hints, but work directly on the map instead of the layer. Any idea how to solve this? Thx, M
Just to understand your query properly, do you want to
a) prevent closing of open popups when opening another one, or b) open several popups at the same time when clicking a marker (for e.g. all markers that belong to the same group)?
Actually I want to open all popups (e.g. on app start) by code, for all the markers. Then, on-demand, the user could close some - but that's a feature with lower priority.
Like this:
library(mapview) # for the data
library(leaflet)
library(leafpop)
brew = breweries[1:2, ]
leaflet() %>%
addTiles() %>%
addCircleMarkers(
data = brew
) %>%
addPopups(
lat = st_coordinates(brew)[, 2]
, lng = st_coordinates(brew)[, 1]
, popup = popupTable(brew)
, options = popupOptions(closeOnClick = FALSE)
)
?
The 1st popup still closes when I open another popup. I have to apply these 2 options:
popupOptions(closeOnClick = FALSE, autoClose=FALSE)
but autoClose does not work :(
Do you have some reproducible code?
Hi-
Thank you so much for this package- it's really great. I have 2 questions that are similar to this:
- I would like to cause 2 different images to pop up either stacked or side by side. Is this possible?
- Alternatively I am interested in adding a dropdown menu to a pop-up that I could then select different images from. Is there any chance that functionality is supported in this package?
Thanks again!
O
Hi @DEQorudlof
- Yes that is possible if you install from github, see e.g. https://github.com/r-spatial/leafpop/issues/19#issuecomment-846376609
- That is currently not possible and I am not planning on adding it anytime soon. For that you would need proper JS knowledge, which I don't have
HTH
Hi Tim-
Thanks for the quick response! I wonder if you could take a quick look at the code that I'm using that is not doing this for me. I don't have a reprex so if there's nothing you could see without one I understand, but maybe you'll see some obvious solution that I don't see:
leaf <-leaflet() %>% addTiles() %>% addMarkers(data = dat2, group = "SNc",popup = ~paste("Facility: ",Facility, ") ) %>% addPopupImages(image = paste0(dat2$SNc,".png"), group = "SNc", width=200, height=200)%>% addPopupImages(image = paste0(dat2$SNc,"._d.png"), group = "SNc", width=300, height=300)
I keep getting a pandoc error: Knitting issue: pandoc.exe: C:\Users\orudlof\AppData\Local\Temp\Rtmporiytk\imagesb6e259\10029.png: openBinaryFile: does not exist (No such file or directory) Error: pandoc document conversion failed with error 1 Execution halted
I don't suppose you have any idea why that would happen? The funny thing is I don't get the error when I do one or the other, it only occurs when I do both.