-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitoring_dashboard.Rmd
159 lines (139 loc) · 7.73 KB
/
monitoring_dashboard.Rmd
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
---
title: "Monitoringplan Dashboard, Manteling van Walcheren"
output:
flexdashboard::flex_dashboard:
theme:
bg: "#e8e8e6" ## lichtgrijs
fg: "#3d4853" ## grijs
primary: "#c2004b" ## rood
base_font:
google: Prompt
code_font:
google: JetBrains Mono
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(leaflet)
library(dplyr)
library(ggplot2)
library(sf)
library(htmltools)
library(VHRscope)
monitoring <- read_sf('natuurmonitoring/alle_soorten_SNL_vlakken.gpkg')
monitoring <- st_transform(monitoring, crs = 'EPSG:4326')
MvW_N2000 <- VHRscope::st_read_N2000NL(gebiedNummer = 117)
MvW_N2000 <- st_transform(MvW_N2000, crs = 'EPSG:4326')
```
## Column {.tabset data-width="650"}
### Per soort
```{r}
pal <- colorFactor(c('gray70','red', 'purple', 'blue'), domain = unique(monitoring$monitoring))
soorten_layers <- monitoring %>% filter(file == 'Insecten.gpkg' ) %>%
pull(layer) %>% unique
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[1] ),
group = soorten_layers[1],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[2] ),
group = soorten_layers[2],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[3] ),
group = soorten_layers[3],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[4] ),
group = soorten_layers[4],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[5] ),
group = soorten_layers[5],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[6] ),
group = soorten_layers[6],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[7] ),
group = soorten_layers[7],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[8] ),
group = soorten_layers[8],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[9] ),
group = soorten_layers[9],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addPolygons(data = monitoring %>% filter(file == 'Insecten.gpkg', layer == soorten_layers[10] ),
group = soorten_layers[10],
color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
fillColor = ~pal(monitoring), popup = ~htmlEscape(paste0(beheertype_code, ' (', beheerder, ')')),
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addLegend(pal = pal, values = monitoring$monitoring %>% unique(),
opacity = 0.7, title = 'monitoring',
position = "bottomright") %>%
addControl(html = HTML('<h4>Monitoring Insecten</h4>'), position = "topright", className="map-title") %>%
addLayersControl(
baseGroups = soorten_layers,
options = layersControlOptions(collapsed = F)
)
```
### Soortlijst per vlak
```{r}
lijst_layers <-
monitoring %>% filter(file == 'Insecten.gpkg', monitoring != 'geen') %>%
mutate(layer = ifelse(monitoring == 'TS N2000', paste0(layer,'*'),layer)) %>%
group_by(id,beheertype_code,beheerder, file ) %>%
arrange(layer) %>%
summarise(layer = paste0(unique(layer), collapse = "<br>"))
beheertypes <- read.csv(file = file.path(system.file(package = "VHRscope"), "extdata", "snl_beheertypen_colors.csv"), sep = ';')
pal <- colorFactor(beheertypes$color, domain = beheertypes$beheertype_code)
leaflet(data = lijst_layers) %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(
color = "#444444", fillColor = ~pal(beheertype_code),
weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.3,
popup = ~layer,
highlightOptions = highlightOptions(color = "white", weight = 2,
bringToFront = TRUE)) %>%
addLegend(pal = pal, values = lijst_layers$beheertype_code %>% unique(),
position = "topleft",
opacity = 0.7, title = 'beheertype_code') %>%
addControl(html = HTML('<h4>Monitoring Insecten</h4>'), position = "topright", className="map-title") #%>%
```