我想将NHD(国家水文数据集)底图(平铺)添加到我的传单地图中。 Here是提供我尝试使用的Hydrography网址的链接。
leaflet()%>%
setView(lng = -76.4, lat = 37, zoom = 09) %>%
addWMSTiles(baseUrl="https://basemap.nationalmap.gov/arcgis/rest/services/USGSHydroCached/MapServer",
layers="Hydrography")
当前返回的底图完全空白。我希望它看起来像this,从其他来源添加WMS磁贴似乎可以正常工作。
答案 0 :(得分:0)
选项#1遵循USGS的this教程。
grp <- c("USGS Topo", "USGS Imagery Only",
"USGS Imagery Topo","USGS Shaded Relief", "Hydrography")
GetURL <- function(service, host = "basemap.nationalmap.gov") {
sprintf("https://%s/arcgis/services/%s/MapServer/WmsServer", host,
service)}`
opt <- leaflet::WMSTileOptions(format = "image/png", transparent = TRUE)
map <- leaflet::leaflet()
map <- leaflet::addWMSTiles(map, GetURL("USGSHydroCached"),
group = grp[5], options = opt, layers = "0")
map <- leaflet::hideGroup(map, grp[5])`
选项#2使用inlmisc
包,CreateWebMap
函数默认情况下会添加水文学基础层