[GIS] Is it possible to map a leaflet provider (precipitation) on top of a polygon in an interactive map

basemaplayersleafletr

I've just started using the leaflet package in R to create interactive maps and I'm wondering if it's possible to plot one of the leaflet providers on top of a plotted polygon rather than under it as a basemap. Here's some example code:

library(raster)
library(leaflet)

ph <- getData("GADM", country = "PHL", level = 1)

leaflet(data = ph) %>%
  addProviderTiles("OpenWeatherMap.Precipitation") %>% 
  addPolygons(fillColor = "red", 
              fillOpacity = 1, 
              color = "#FFFFFF", 
              weight = 1.3)

This simply plots a shapefile of the Philippines (in my real example, it's a choropleth map). The precipitation basemap was found here (toward the bottom of the list; OpenWeatherMap.Precipitation). Here's what the output looks like:

enter image description here

It might be a little difficult to see, but the precip layer is plotted as a basemap, so all of that info is going under the ph shapefile. I'm trying to find a way so that the precipitation layer goes OVER the Philippines shapefile. I'm not sure if this is even possible, but it seems like I should be able to have a plain OSM basemap with the shapefile plotted on top and the precipitation layer on top of the .shp. As it is now, I know that I can alter the opacity of the shapefile, but this isn't much of a solution for a detailed choropleth map. Is this possible, and if so, how do I do it?

Best Answer