Created
February 25, 2023 13:29
-
-
Save tim-salabim/8fd85c739b68d5bf2c4bba4ac05be2c2 to your computer and use it in GitHub Desktop.
layer selector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(mapview) | |
library(leafem) | |
library(leaflet) | |
library(sf) | |
library(geojsonsf) | |
franc_ext <- unname(as.vector(st_bbox(franconia))) | |
francgj = geojsonsf::sf_geojson(franconia) | |
leaflet() |> | |
addTiles() |> | |
addGeoJSON(francgj, layerId = "franc", group = "franc", weight = 1) |> | |
fitBounds(franc_ext[1], franc_ext[2], franc_ext[3], franc_ext[4]) |> | |
leafem:::addLayerSelector(colnames(franconia), "franc") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New version