-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path051_map_GRanD.R
81 lines (71 loc) · 3.74 KB
/
051_map_GRanD.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
library(tidyverse)
library(sf)
library(mapview)
#### Load data ----
existing_dams <- readRDS("outputs/rds/existing_dams_scenarios.rds") %>%
mutate(CapacityCex = abs(sqrt(Capacity))/10) # for visualization purposes only
# Maps ----
mapviewOptions(legend.pos = "bottomleft")
mapviewOptions(fgb = FALSE)
my_col.regions <- colorRampPalette(scales::brewer_pal(type = "div", palette = "RdYlBu", direction = -1)(9))
legendBreaks <- c(-1.6, -1.2, -0.8, -0.4, -0.2, 0.2, 0.4, 0.8, 1.2, 1.6)
#### 1. GRanD & Change in Scarcity (Pessimistic 2050) ----
mapview(existing_dams, layer.name =
"Existing dams under<br/>pessimistic scenario for 2050<br/>–––––––––––––––––––––––––––<br/>Change in scarcity risk (color)<br/>Reservoir capacity (size)",
zcol = "RC1_P50rc", cex = existing_dams$CapacityCex, label = existing_dams$Name,
col.regions = my_col.regions,
at = legendBreaks,
alpha.regions = 0.8,
lwd = 0.1,
viewer.suppress = FALSE,
popup = leafpop::popupTable(existing_dams, zcol = c("Name", "Capacity", "Country", "Basin", "RC1", "RC1_P50", "RC1_P50rc"))
) %>%
leafem::addLogo(
#"https://panda.maps.arcgis.com/sharing/rest/content/items/eaf9bbe5243d4dca8073e3517517bd71/data", src = "remote", # Black
"https://panda.maps.arcgis.com/sharing/rest/content/items/203af4ae947245948ad0958bc2c7ea9c/data", src = "remote", # White
position = "bottomleft",
offset.x = 20,
offset.y = 330,
width = 200,
height = 40.5) %>%
leaflet::setView(10, 20, 3)
#### 2. GRanD & Change in Flooding (Pessimistic 2050) ----
mapview(existing_dams, layer.name =
"Existing dams under<br/>pessimistic scenario for 2050<br/>–––––––––––––––––––––––––––<br/>Change in flood risk (color)<br/>Reservoir capacity (size)",
zcol = "RC2_P50rc", cex = existing_dams$CapacityCex, label = existing_dams$Name,
col.regions = my_col.regions,
at = legendBreaks,
alpha.regions = 0.8,
lwd = 0.1,
viewer.suppress = FALSE,
popup = leafpop::popupTable(existing_dams, zcol = c("Name", "Capacity", "Country", "Basin", "RC2", "RC2_P50", "RC2_P50rc"))
) %>%
leafem::addLogo(
#"https://panda.maps.arcgis.com/sharing/rest/content/items/eaf9bbe5243d4dca8073e3517517bd71/data", src = "remote", # Black
"https://panda.maps.arcgis.com/sharing/rest/content/items/203af4ae947245948ad0958bc2c7ea9c/data", src = "remote", # White
position = "bottomleft",
offset.x = 20,
offset.y = 330,
width = 200,
height = 40.5) %>%
leaflet::setView(10, 20, 3)
#### 6a. GRanD & Biodiversity (2020) ----
mapview(existing_dams, layer.name =
"Existing dams risks to<br/>freshwater biodiversity<br/>–––––––––––––––––––––––––––<br/>Biodiversity risk in 2020 (color)<br/>Reservoir capacity (size)",
zcol = "RC10", cex = existing_dams$CapacityCex, label = existing_dams$Name,
col.regions = colorRampPalette(c("#e9ffbe", "#ffd700", "#e60000")),
at = c(1, 1.4, 1.8, 2.2, 2.6, 3, 3.4, 3.8, 4.2, 4.6, 5),
alpha.regions = 0.7,
lwd = 0.1,
viewer.suppress = FALSE,
popup = leafpop::popupTable(existing_dams, zcol = c("Name", "Capacity", "Country", "Basin", "Basin", "RC10"))
) %>%
leafem::addLogo(
#"https://panda.maps.arcgis.com/sharing/rest/content/items/eaf9bbe5243d4dca8073e3517517bd71/data", src = "remote", # Black
"https://panda.maps.arcgis.com/sharing/rest/content/items/203af4ae947245948ad0958bc2c7ea9c/data", src = "remote", # White
position = "bottomleft",
offset.x = 20,
offset.y = 350,
width = 200,
height = 40.5) %>%
leaflet::setView(10, 20, 3)