Created
December 13, 2021 13:33
-
-
Save patperu/3d1a7c499c79c4629ac23f353aad33dc to your computer and use it in GitHub Desktop.
Using WMS Tiles (wms_topplus_open) with mapview
This file contains hidden or 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(tidyverse) | |
library(sf) | |
library(leaflet) | |
library(mapview) | |
dat <- tibble::tribble( | |
~rowid, ~nkm_qm, ~lat, ~long, | |
1L, 8.18, 52.449917, 13.381893, | |
2L, 8, 51.576676, 7.229981, | |
3L, 11.5, 53.890169, 10.668716, | |
4L, 15.59, 52.448414, 13.369738, | |
5L, 3.85, 53.530143, 13.26619, | |
6L, 11.89, 50.796699, 7.096234, | |
7L, 7.04, 54.334485, 10.13537, | |
8L, 7.8, 54.337764, 10.134051, | |
9L, 9.92, 49.493545, 11.113493, | |
10L, 6.91, 53.689489, 10.144709 | |
) | |
dat <- dat %>% | |
sf::st_as_sf(coords = c("long", "lat"), crs = 4326) | |
nkm_qm_mapview <- mapview(dat, zcol = "nkm_qm") | |
# https://mhweber.github.io/2018/11/09/adding-wms-basemap-in-r-with-mapview/ | |
# Frau Dr. John, Landeshauptstadt Hannover | |
nkm_qm_mapview@map = nkm_qm_mapview@map %>% | |
addWMSTiles( | |
group = "Verwaltungstiles", | |
baseUrl = "https://sgx.geodatenzentrum.de/wms_topplus_open", | |
layers = "web_grau", | |
options = WMSTileOptions( | |
token = "public", | |
format = "image/png", | |
transparent = TRUE | |
), | |
attribution = "wms_topplus_open") %>% | |
mapview:::mapViewLayersControl(names = c("Verwaltungstiles")) | |
nkm_qm_mapview |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment