Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapview - Can we set the radiobuttons also for the raster data? #458

Open
agronomofiorentini opened this issue Sep 12, 2023 · 3 comments
Open

Comments

@agronomofiorentini
Copy link

Dear creators,
First of all thanks to have build this amazing package, at least once a day I use mapview.

I would like to ask if it is possible to be able to include an argument that allows users to define whether we want to have raster data with checkboxes or radiobuttons.

image

I am asking because this allows us to be able to view one raster map at a time and not all togheter.

Thanks, and i hope this can help others.

@tim-salabim
Copy link
Member

I think this would need to be implemented in leaflet, rather than here. IIRC there's already an issue on the leaflet github repo asking for this. Did you have a look there?

@agronomofiorentini
Copy link
Author

Dear @tim-salabim, always ready to help.

I haven't had a look yet to the leaflet github repo actually and i will take a look. Anyway thanks.

@agronomofiorentini
Copy link
Author

@tim-salabim

I have this code that i want to show you and it's full reproducible code

library(plainview)
library(leaflet)

poppendorf

map<-leaflet() %>%
  leaflet::addProviderTiles(provider = providers$OpenStreetMap, group = "Google Maps") %>%
  leaflet::addProviderTiles(provider = providers$Esri.WorldImagery, group = "Satellite")

names<-names(poppendorf)

for (i in seq(from=1,by=1,to=length(names))) {
  map<-map %>%
    addRasterImage(poppendorf[[names[i]]], group = names[i])
}

There are three different options that don't allow us to set what we would like to achieve "A leaflet map that allow us to have radiobuttons for both baseGroups and overlayGroups "

1

map<-map %>%
  addLayersControl(
    position = c("topleft"),
    baseGroups = names,
    overlayGroups = c("Satellite", "Google Maps"),
    options = layersControlOptions(collapsed = F, autoZIndex = F)
  )

map

2

map<-map %>%
  addLayersControl(
    position = c("topleft"),
    baseGroups = c("Satellite", "Google Maps", names),
    options = layersControlOptions(collapsed = F, autoZIndex = F)
  )

map

3

map<-map %>%
  addLayersControl(
    position = c("topleft"),
    baseGroups = c("Satellite", "Google Maps", names),
    options = layersControlOptions(collapsed = F, autoZIndex = F)
  )

map

Can you please paste here below the link of the github issue that you refered before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants