R Leaflet – Adding Weather Radar Data from Website

leafletrradarweatherwms

I am looking to add a specific layer from this website (https://www.iweathernet.com/total-rainfall-map-24-hours-to-72-hours) to a leaflet map in R. I have tried the code below, but the data does not seem to add to the map.

library(leaflet)
url='https://www.iweathernet.com/total-rainfall-map-24-hours-to-72-hours'
leaflet() %>%
  addTiles() %>%
  setView(lat=42,lng = -78,zoom=6) %>%
  addWMSTiles(url,layers=0)

Note that I have changed the number to a few different options in:

layers = 0

The website in question has 10 different base maps as options in a dropdown, in addition to 6 different times for retrospective weather data as a dropdown option.

Best Answer

That URL is not a WMS server, its a web page.

The web page has a Javascript application running that produces the map.

The map contains several layers, including the base map (land/sea) and a rainfall overlay.

The rainfall overlay appears to be coming from nowcoast.noaa.org, as an ESRI API map via leaflet.

However nowcoast.noaa.org do have some WMS services:

https://nowcoast.noaa.gov/help/#!section=map-service-list

So if you can find the service you want in the list and construct the URL correctly you should be able to map it.

For example, this URL:

url="https://nowcoast.noaa.gov/arcgis/services/nowcoast/analysis_meteohydro_sfc_qpe_time/MapServer/WMSServer"

works with:

addWMSTiles(url,layers="1")

or if you want transparency:

addWMSTiles(url, layers="1", options=list(format="image/png", transparent="true"))

The "layers" parameter can let you get more than one layer. There's a hierarchical structure which is in the XML of the GetCapabilities document you linked to, and you can see it with QGIS' WMS layers dialog:

enter image description here

The "layers" numbers here are the "name" column, so the 24h image seems to be layer 9 (you can check this in the XML):

enter image description here

addWMSTiles(url, layers="9", options=list(format="image/png", transparent="true"))

might be what you want.