-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
set_filter()
not working within rhino framework
#12
Comments
Appreciate your note! I've never used Rhino before so this might take me a little more time to figure out. However, I'd like to make sure that the package works within any of the frameworks in which it might be used. |
I can't get your app to run (an issue with PROJ I'm having within packrat it seems) but can you try this in your module's server code? ns <- NS(id)
observe({
mapgl$mapboxgl_proxy(ns("map")) |>
mapgl$set_filter("polygon_layer",
list(">=", mapgl$get_column("measure"), input$slider))
}) If that works, I can look at ways to avoid that step in the future. |
Hi @walkerke Partially my mistake - I didn't have an It does work with the ns() on the server side as you mention once I have fixed up the slider input.
But also, I had a look into Using this function (adapted from leaflet's) to create the
|
Quick follow up: adding the ns() to the existing call to There's a slight issue still with this implementation that I think leaflet has figured out by having a |
Perhaps this is a separate issue but would it be possible to use a My use case is where I want to filter to keep a selection based on several inputs (I'd be likely to make the set_filter() act on some 'shape_id'-like column which I get from filtering a copy of the input data by those multiple inputs). |
Thanks @RWParsons! I'll make those edits.
I've done some work to try to get mapboxgl_proxy("your_map") |>
set_filter("your_layer_id", list("in", "your_column_name", input$select_input_id)) I would love to be able to do this: mapboxgl_proxy("your_map") |>
set_filter("your_layer_id", filter_expr(column %in% input$select_input_id)) But I haven't gotten it working yet. |
Thanks quick responses @walkerke! I've just tested it out and with the use of "in" as you've shown, it works for when the input is a single value but not when it is a vector. Here is the example that I'm working with:
|
Hi @walkerke, I've made a PR for the proxy functions to fix the namespacing issue. I think this covers the OP of this issue but I'm happy to make separate issues for the following things that have come out of the discussion.
Let me know if these are sensible from your perspective and I'll write them up with reprexes in separate issues. Thanks! |
I've made two more issues to address the points above and will now close this issue. Thanks, @walkerke! |
This could well be a me problem as I'm just figuring out my way around mapgl today.
I'm working on a larger app which uses rhino but have found that I can't get
mapgl::set_filter()
to work. I've made a smaller app here - https://github.com/RWParsons/test-app. This has a rhino app with a map shown in the main module https://github.com/RWParsons/test-app/blob/main/app/main.R but the filter does not trigger changes on the map.I have made the same app but without the modules/rhino framework and it works fine: https://github.com/RWParsons/test-app/blob/main/normal-app.R
Any help would be greatly appreciated
Thanks for your work on this package, @walkerke, I'm very keen be able to work mapgl into this project of mine 😄
The text was updated successfully, but these errors were encountered: