pal_vuln <- colorNumeric(
palette = "inferno", domain = c(0, 1),
na.color = "transparent", reverse = FALSE
)
pal_slr <- colorFactor(
palette = c("#08519c", "#3182bd", "#9ecae1", "#deebf7"),
domain = c(0.5, 1.0, 2.0, 3.0), na.color = "transparent"
)
interactive_map <- leaflet() %>%
addProviderTiles("CartoDB.Positron", group = "Basemap (Light)") %>%
addProviderTiles("Esri.WorldImagery", group = "Satellite") %>%
addRasterImage(x = vuln_wgs, colors = pal_vuln,
opacity = 0.7, group = "Vulnerability Index") %>%
addLegend(position = "bottomleft", pal = pal_vuln, values = c(0, 1),
title = "Vulnerability<br>Index", group = "Vulnerability Index") %>%
addRasterImage(x = slr_wgs, colors = pal_slr,
opacity = 0.65, group = "SLR Inundation") %>%
addLegend(position = "bottomright", pal = pal_slr,
values = c(0.5, 1.0, 2.0, 3.0),
title = "First Flooded<br>at SLR (m)", group = "SLR Inundation",
labFormat = labelFormat(suffix = " m")) %>%
addLayersControl(
baseGroups = c("Basemap (Light)", "Satellite"),
overlayGroups = c("Vulnerability Index", "SLR Inundation"),
options = layersControlOptions(collapsed = FALSE)
) %>%
addScaleBar(position = "bottomleft") %>%
addMiniMap(toggleDisplay = TRUE, minimized = TRUE) %>%
setView(lng = -75.75, lat = 35.25, zoom = 10)