0
votes

I've been trying to get this map (below) into leaflet in R as a layer via The National Map's WMS but haven't had any success.

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

Here is my code:

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

1 Answers

1
votes

I found the issue. When I looked at the RStudio viewer console it had "Failed to load resource: Unable to init SSL Context:" for each raster image. If anyone else runs up against this, it is a problem with the RStudio viewer and they are currently working on a fix. It should display properly if you run it as html in a browser. The same is true with Shiny.