0

I had previously built a Leaflet map that pulled past precipitation data (24, 48, and 72 hours) from the NOAA nowCOAST site, however, the site was decommissioned. I used a previous StackExchange post to built the Leaflet map here: Adding weather radar data to leaflet from website

The goal of my map was to match the map shown at this website: https://www.iweathernet.com/total-rainfall-map-24-hours-to-72-hours which looks like this:

enter image description here

To reiterate, the leaflet map and the map at this website had matched previously. After the decommission of nowCOAST, I inspected the new data source for the site at it revealed that it is pulling data from a NOAA mapserver: https://mapservices.weather.noaa.gov/raster/rest/services/obs/rfc_qpe/MapServer enter image description here

The problem arises when I try to use the same data pull to recreate the leaflet map. I used R, like so:

library(leaflet)
library(sf)
library(tidyverse)
library(rgdal)

tdir=tempdir()
stateurl = "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_state_500k.zip"
if(file.exists(paste(tdir,"/cb_2018_us_state_500k.shp",sep=""))==F){
  download.file(stateurl, destfile = file.path(tdir, "States.zip"))
  unzip(file.path(tdir,"States.zip"),exdir=tdir)}
NYS = read_sf(paste(tdir,"/cb_2018_us_state_500k.shp",sep="")) %>%
  filter(NAME=="New York") %>%
  st_transform(.,crs=32618)
USA = read_sf(paste(tdir,"/cb_2018_us_state_500k.shp",sep="")) %>%
  filter(!c(GEOID%in%c("72","02","60","78","15","69","66"))) %>%
  st_union()


url = "https://mapservices.weather.noaa.gov/raster/services/obs/rfc_qpe/MapServer/WMSServer?"
leaflet() %>%
  addTiles() %>%
  addPolylines(data=USA,
               color = "red",
               stroke = TRUE,
               weight=3,
               group = "USA") %>%
  addWMSTiles(url,
              layers="25",
              options = WMSTileOptions(format = "image/png",
                                       transparent = TRUE,
                                       opacity=.7),
              group = "24-Hr Accumulation")

Created on 2024-05-24 with reprex v2.0.2

Clearly, the map created by pulling from the data source does not match the website.

4
  • 3
    Have you tried different layer numbers? For me, layer 253 looks like the 1h accumulation map. Check with the WMS capabilties metadata mapservices.weather.noaa.gov/raster/services/obs/rfc_qpe/…
    – Spacedman
    Commented May 24 at 15:12
  • Wow, that worked. I found the correct layer numbers there. Just curious, why does it not match up with the layer numbers here? mapservices.weather.noaa.gov/raster/rest/services/obs/rfc_qpe/… Commented May 24 at 21:14
  • Those layer numbers are MapServer API layers, you're using a WMS server API in your URL. Assuming this is the WMS add-on to MapServer, its controlled by its own configuration file so it has a potentially different layer list available.
    – Spacedman
    Commented May 25 at 8:08
  • 3
    @Spacedman I think this should go into an answer. Weather data is widely used and answer might help somebody with the same/similar problem.
    – TomazicM
    Commented May 25 at 9:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.