-
Notifications
You must be signed in to change notification settings - Fork 12
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
Return a rendered leaflet map from leafletProxy() #59
Comments
Hello, Can you explain why do you want to do this? Using a manipulateWidget inside a shiny app is not documented for now, but you can find some examples here: https://github.com/rte-antares-rpackage/manipulateWidget/tree/master/inst/examples . With manipulateWidget, you can add modules to a shiny application. The modules can use reactive values from the application but they are not intended to modify other elements of the application. |
Thanks for the quick reply @FrancoisGuillem! Maybe I don't understand the aim of manipulateWidget well enough, but I thought it returned already rendered objects and let you modify them. The reason why I asked the question was that in a Shiny app you can create a leaflet map using Right now there are two workaround solutions to this problem:
Neither solution seems to be ideal, so thought it would be worth posing the question more broadly, but this probably isn't the right place. I'll close this issue now. |
I don't know if it can helps, but with manipulateWidget you can generate a leaflet map, update it and save it into an html file: Here is the code to generate it: myMapFun <- function(radius, color, initial, session, output) {
if (initial) {
# Widget has not been rendered
map <- leaflet() %>% addTiles()
} else {
# widget has already been rendered
map <- leafletProxy(output, session) %>% clearMarkers()
}
map %>% addCircleMarkers(lon, lat, radius = radius, color = color)
}
manipulateWidget(myMapFun(radius, color, .initial, .session, .output),
radius = mwSlider(5, 30, 10),
color = mwSelect(c("red", "blue", "green"))) This looks more or less like your first solution: when the user clicks the save button, a new htmlWidget object is created using the current values of the inputs. |
This is a random question but seems related to how the package is grabbing rendered widgets and updating them. Is it possible to retrieve a rendered leaflet map? For example, I want to use code like
manipulateWidget(leafletProxy("objectId"))
to return the same class of object as you get when a leaflet map is first created withleaflet()
. It seems simple, but is this possible?Here is a more complete example:
The text was updated successfully, but these errors were encountered: