I have geometry at the county and municipal level. I want the user to be able to toggle between viewing the county data and the municipal data using a select input.
The default selected choice is "county," so I want the map to show only county level data when rendered. The following code works when using maplibreOutput() and renderMaplibre(). The code does not work when using maplibreCompareOutput() and renderMaplibreCompare(). It renders all of the geometry rather than just the filtered geometry.
add_line_layer(
id = "layer1",
source = "sf1",
filter = list("==", get_column("level"), "county"),
tooltip = "test"
)
However, after the user changes the selected input once, set_filter() works with the compare proxy in the same way it works with the normal proxy.
app.R.txt
I have geometry at the county and municipal level. I want the user to be able to toggle between viewing the county data and the municipal data using a select input.
The default selected choice is "county," so I want the map to show only county level data when rendered. The following code works when using maplibreOutput() and renderMaplibre(). The code does not work when using maplibreCompareOutput() and renderMaplibreCompare(). It renders all of the geometry rather than just the filtered geometry.
However, after the user changes the selected input once, set_filter() works with the compare proxy in the same way it works with the normal proxy.
app.R.txt