You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm somehow referring to issue #62. I would like to cover 2 issues here:
layers control
groups
As for the first issue - I would like to hide/show points on the map upon clicking on the button (in short - toggle points on the map). I'm wondering how I could do it using mapboxer since I can't get to layer's properties like visibility. What I can only do, I guess, is setting visibility using set_layout_properties e.g. set_layout_property(ns("map"), layer_id="points", property="visibility", value="visible"). However, I don't know how to first get to the layer's properties (something what's possible in mapbox's function getLayoutProperty). Please take a look at this example from mapbox site: https://docs.mapbox.com/mapbox-gl-js/example/toggle-layers/
where visibility is get/set using getLayoutProperty/setLayoutProperty.
Or maybe there's other way to do it, without getting and setting visibility from a layer. Below is my workable example from #62, where I added some dummy code (in observeEvent) showing how I would 'toggle' points on the map (I have only one button in this example but in my app I have 3 buttons and want to add some logic to observe event, e.g if points 'xyz' are visible one the map then show points 'kkk' etc.).
Another issue is groups. Is it possible to make groups using mapboxer just like it's possible in leaflet? In leaflet I can use function addLayersControl which manage groups quite easily (also enables toggling points on a map). Please take a look at this example where it's shown clearly: https://rstudio.github.io/leaflet/showhide.html
And here is my workable example with commented dummy code:
@Camil88 See shiny-toogle-layer-example where it is done via set_layout_property. You just have to store the current visibility properties of your layers in your shiny app. Furthermore, a layer switcher control is on the way, I already played around with a lot of new controls in the develop and feature/sliders branch. But I have to finish them, so that they can be merged into master. Maybe I can add a addLayerSwitcherControl in the coming days, because I think it is very useful.
Hi,
I'm somehow referring to issue #62. I would like to cover 2 issues here:
As for the first issue - I would like to hide/show points on the map upon clicking on the button (in short - toggle points on the map). I'm wondering how I could do it using
mapboxer
since I can't get to layer's properties likevisibility
. What I can only do, I guess, is setting visibility usingset_layout_properties
e.g.set_layout_property(ns("map"), layer_id="points", property="visibility", value="visible")
. However, I don't know how to first get to the layer's properties (something what's possible in mapbox's functiongetLayoutProperty
). Please take a look at this example from mapbox site:https://docs.mapbox.com/mapbox-gl-js/example/toggle-layers/
where
visibility
is get/set usinggetLayoutProperty
/setLayoutProperty
.Or maybe there's other way to do it, without getting and setting
visibility
from a layer. Below is my workable example from #62, where I added some dummy code (inobserveEvent
) showing how I would 'toggle' points on the map (I have only one button in this example but in my app I have 3 buttons and want to add some logic toobserve event
, e.g if points 'xyz' are visible one the map then show points 'kkk' etc.).Another issue is groups. Is it possible to make groups using
mapboxer
just like it's possible inleaflet
? Inleaflet
I can use functionaddLayersControl
which manage groups quite easily (also enables toggling points on a map). Please take a look at this example where it's shown clearly: https://rstudio.github.io/leaflet/showhide.htmlAnd here is my workable example with commented dummy code:
The text was updated successfully, but these errors were encountered: