2017-08-07 31 views
0

我一直試圖通過國家地圖的WMS將該地圖(下圖)作爲圖層獲取到R的單張中,但沒有取得任何成功。將WMS添加到宣傳單

https://raster.nationalmap.gov/arcgis/services/LandCover/USGS_EROS_LandCover_NLCD/MapServer/WMSServer?request=GetMap&service=WMS&Version=1.3.0&BBOX=-14497453.9,248608.9,-7087933.9,6960328.9&Styles=&Format=image/png&layers=33&crs=EPSG:3857&width=600&height=400&Transparent=true

這裏是我的代碼:

map <- leaflet() %>% addTiles() %>% 
addWMSTiles(baseUrl="https://raster.nationalmap.gov/ArcGIS/services/LandCover/USGS_EROS_LandCover_NLCD/MapServer/WMSServer?", 
layers = "33", 
group = "NLCD", 
options = WMSTileOptions(
format = "image/png", 
version = "1.3.0", 
transparent = TRUE)) %>% 
addLayersControl(
overlayGroups = c("NLCD"), 
position = 'bottomleft') 

map 

回答

1

我發現這個問題。當我查看RStudio查看器控制檯時,它對每個光柵圖像都有「無法加載資源:無法啓動SSL上下文:」。如果其他人遇到這種情況,這是RStudio查看器的問題,他們目前正在修復。如果您在瀏覽器中將其作爲html運行,它應該正確顯示。 Shiny也是如此。