Skip to content

Commit f117f97

Browse files
authored
Merge pull request #133 from wri/dev
Biodiversity indicators - Proportion of natural areas #127
2 parents dc8fa72 + 4bb687f commit f117f97

File tree

72 files changed

+188558
-2908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+188558
-2908
lines changed

baseline-indicators/biodiversity/reports/UrbanShift-Biodiversity-ARG-Buenos_Aires.Rmd

+58
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,64 @@ city_worldcover_stat %>%
194194
scroll_box(width = "100%", height = "300px")
195195
```
196196

197+
198+
### Global Biodiversity Information Facility (GBIF)
199+
200+
201+
```{r GBIF-map-metropilitan, warning=FALSE, message=FALSE, echo = FALSE, eval = TRUE}
202+
203+
city_gbif = read.csv(paste("./data/biodiversity/gbif/GBIF-",city_id,".csv", sep = ""))
204+
city_boundary = urbanshift_boundaries[urbanshift_boundaries$city_name == city_id, ]
205+
206+
# filter AVES
207+
city_gbif_Aves = city_gbif %>%
208+
filter(class == "Aves")
209+
210+
# plot map
211+
leaflet(data = city_boundary, height = 500, width = "100%") %>%
212+
addTiles() %>%
213+
addProviderTiles("OpenStreetMap.France", group = "OSM") %>%
214+
addProviderTiles(providers$CartoDB.DarkMatter , group = "CartoDB") %>%
215+
# Add boundaries
216+
addPolygons(data = city_boundary,
217+
group = "Administrative boundaries",
218+
stroke = TRUE, color = "black", weight = 3,dashArray = "3",
219+
smoothFactor = 0.3, fill = TRUE, fillOpacity = 0.2,
220+
highlight = highlightOptions(
221+
weight = 5,
222+
color = "#666",
223+
dashArray = "",
224+
fillOpacity = 0.3,
225+
bringToFront = FALSE)) %>%
226+
# add cluster markers
227+
addMarkers(city_gbif_Aves$lat,
228+
city_gbif_Aves$long,
229+
popup = ~as.character(city_gbif_Aves$family),
230+
# label = label_birds2020,
231+
clusterOptions = markerClusterOptions(),
232+
group = "Birds clusters") %>%
233+
# add birds layer
234+
addCircleMarkers(city_gbif_Aves$lat,
235+
city_gbif_Aves$long,
236+
radius = 3,
237+
fillColor = "green",
238+
color = "black",
239+
stroke = TRUE,
240+
weight = 0.8,
241+
fillOpacity = 0.6,
242+
popup = ~as.character(city_gbif_Aves$family),
243+
# label = label_birds2020,
244+
group = "Birds observations") %>%
245+
# Layers control
246+
addLayersControl(
247+
baseGroups = c("OSM","CartoDB"),
248+
overlayGroups = c("Birds observations","Birds clusters"),
249+
options = layersControlOptions(collapsed = FALSE)
250+
)
251+
```
252+
253+
254+
197255
## Baseline indicators
198256

199257
```{r Initialize_baseline, warning=FALSE, message=FALSE, echo = FALSE, eval = TRUE}

baseline-indicators/biodiversity/reports/UrbanShift-Biodiversity-ARG-Buenos_Aires.html

+21-4
Large diffs are not rendered by default.

baseline-indicators/biodiversity/reports/UrbanShift-Biodiversity-ARG-Mendoza.Rmd

+124
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,127 @@ city_worldcover_stat %>%
191191
kable_styling(bootstrap_options = c("striped", "hover"), full_width = F, font_size = 13)%>%
192192
scroll_box(width = "100%", height = "300px")
193193
```
194+
195+
### Global Biodiversity Information Facility (GBIF)
196+
197+
198+
```{r GBIF-map-metropilitan, warning=FALSE, message=FALSE, echo = FALSE, eval = TRUE}
199+
200+
city_gbif = read.csv(paste("./data/biodiversity/gbif/GBIF-",city_id,".csv", sep = ""))
201+
city_boundary = urbanshift_boundaries[urbanshift_boundaries$city_name == city_id, ]
202+
203+
# filter AVES
204+
city_gbif_Aves = city_gbif %>%
205+
filter(class == "Aves")
206+
207+
# plot map
208+
leaflet(data = city_boundary, height = 500, width = "100%") %>%
209+
addTiles() %>%
210+
addProviderTiles("OpenStreetMap.France", group = "OSM") %>%
211+
addProviderTiles(providers$CartoDB.DarkMatter , group = "CartoDB") %>%
212+
# Add boundaries
213+
addPolygons(data = city_boundary,
214+
group = "Administrative boundaries",
215+
stroke = TRUE, color = "black", weight = 3,dashArray = "3",
216+
smoothFactor = 0.3, fill = TRUE, fillOpacity = 0.2,
217+
highlight = highlightOptions(
218+
weight = 5,
219+
color = "#666",
220+
dashArray = "",
221+
fillOpacity = 0.3,
222+
bringToFront = FALSE)) %>%
223+
# add cluster markers
224+
addMarkers(city_gbif_Aves$lat,
225+
city_gbif_Aves$long,
226+
popup = ~as.character(city_gbif_Aves$family),
227+
# label = label_birds2020,
228+
clusterOptions = markerClusterOptions(),
229+
group = "Birds clusters") %>%
230+
# add birds layer
231+
addCircleMarkers(city_gbif_Aves$lat,
232+
city_gbif_Aves$long,
233+
radius = 3,
234+
fillColor = "green",
235+
color = "black",
236+
stroke = TRUE,
237+
weight = 0.8,
238+
fillOpacity = 0.6,
239+
popup = ~as.character(city_gbif_Aves$family),
240+
# label = label_birds2020,
241+
group = "Birds observations") %>%
242+
# Layers control
243+
addLayersControl(
244+
baseGroups = c("OSM","CartoDB"),
245+
overlayGroups = c("Birds observations","Birds clusters"),
246+
options = layersControlOptions(collapsed = FALSE)
247+
)
248+
```
249+
250+
## Baseline indicators
251+
252+
```{r Initialize_baseline, warning=FALSE, message=FALSE, echo = FALSE, eval = TRUE}
253+
# initialize empty dataframe for storing indicators
254+
biodiversity_indicators = data.frame(city_id = as.character(),
255+
indicator_name = as.character(),
256+
indicator_number = as.character(),
257+
value = as.numeric(),
258+
score = as.numeric())
259+
```
260+
261+
### I-1. Porportion of natural areas
262+
263+
Natural ecosystems contain more species than human-altered landscapes, hence, the higher the percentage of natural areas compared to that of the total city area gives an indication of the amount of biodiversity.
264+
265+
Natural ecosystems are defined as all areas that are natural and not highly disturbed or completely human-altered landscapes. Examples of natural ecosystems include forests, mangroves, freshwater swamps, natural grasslands, streams, lakes, etc. Parks, golf courses, roadside plantings are not considered as natural. However, natural ecosystems within parks where native species are dominant can be included in the computation.
266+
267+
This indicator is calculated as the percent of natural area within the city boundary: *(Total area of natural, restored and naturalised areas) ÷ (Area of city) × 100%*
268+
269+
Based on the assumption that,by definition, a city comprises predominantly human-altered landscapes, the maximum score will be accorded to cities with natural areas occupying more than 20% of the total city area.
270+
271+
```{r I1, warning=FALSE, message=FALSE, echo = FALSE, eval = TRUE}
272+
273+
natural_areas_classes = c('Trees','Shrubland','Grassland','Snow/ice','Open water','Herbaceous wetland',
274+
'Mangroves','Moss/lichen')
275+
276+
compute.i1 = function(city_id,city_worldcover_stat){
277+
278+
natural_areas_classes = c('Trees','Shrubland','Grassland','Snow/ice','Open water','Herbaceous wetland',
279+
'Mangroves','Moss/lichen')
280+
281+
biodiversity_indicators = city_worldcover_stat %>%
282+
mutate(natural_areas_class =
283+
case_when(`land cover class` %in% natural_areas_classes ~ "Natural areas",
284+
!`land cover class` %in% natural_areas_classes ~ "Non Natural areas")
285+
) %>%
286+
group_by(natural_areas_class) %>%
287+
summarise(natural_areas_percent = sum(`land percent`)) %>%
288+
filter(natural_areas_class == "Natural areas") %>%
289+
add_column(city_id = city_id,
290+
indicator_name = "Proportion of natural areas",
291+
indicator_number = "I1") %>%
292+
rename(value = natural_areas_percent) %>%
293+
mutate(score =
294+
case_when(value < 1 ~ "0",
295+
value <= 6.9 ~ "1",
296+
value <= 13.9 ~ "2",
297+
value <= 20 ~ "3",
298+
value > 20 ~ "4")) %>%
299+
dplyr::select(city_id,
300+
indicator_name,
301+
indicator_number,
302+
value,
303+
score)
304+
305+
return(biodiversity_indicators)
306+
}
307+
308+
309+
biodiversity_indicators = compute.i1(city_id = city_id,
310+
city_worldcover_stat = city_worldcover_stat)
311+
312+
# plot table
313+
biodiversity_indicators %>%
314+
kable() %>%
315+
kable_styling(bootstrap_options = c("striped", "hover"), full_width = F, font_size = 13)%>%
316+
scroll_box(width = "100%", height = "100px")
317+
```

baseline-indicators/biodiversity/reports/UrbanShift-Biodiversity-ARG-Mendoza.html

+71-4
Large diffs are not rendered by default.

baseline-indicators/biodiversity/reports/UrbanShift-Biodiversity-ARG-Salta.Rmd

+125
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,129 @@ city_worldcover_stat %>%
190190
kable() %>%
191191
kable_styling(bootstrap_options = c("striped", "hover"), full_width = F, font_size = 13)%>%
192192
scroll_box(width = "100%", height = "300px")
193+
```
194+
195+
196+
### Global Biodiversity Information Facility (GBIF)
197+
198+
199+
```{r GBIF-map-metropilitan, warning=FALSE, message=FALSE, echo = FALSE, eval = TRUE}
200+
201+
city_gbif = read.csv(paste("./data/biodiversity/gbif/GBIF-",city_id,".csv", sep = ""))
202+
city_boundary = urbanshift_boundaries[urbanshift_boundaries$city_name == city_id, ]
203+
204+
# filter AVES
205+
city_gbif_Aves = city_gbif %>%
206+
filter(class == "Aves")
207+
208+
# plot map
209+
leaflet(data = city_boundary, height = 500, width = "100%") %>%
210+
addTiles() %>%
211+
addProviderTiles("OpenStreetMap.France", group = "OSM") %>%
212+
addProviderTiles(providers$CartoDB.DarkMatter , group = "CartoDB") %>%
213+
# Add boundaries
214+
addPolygons(data = city_boundary,
215+
group = "Administrative boundaries",
216+
stroke = TRUE, color = "black", weight = 3,dashArray = "3",
217+
smoothFactor = 0.3, fill = TRUE, fillOpacity = 0.2,
218+
highlight = highlightOptions(
219+
weight = 5,
220+
color = "#666",
221+
dashArray = "",
222+
fillOpacity = 0.3,
223+
bringToFront = FALSE)) %>%
224+
# add cluster markers
225+
addMarkers(city_gbif_Aves$lat,
226+
city_gbif_Aves$long,
227+
popup = ~as.character(city_gbif_Aves$family),
228+
# label = label_birds2020,
229+
clusterOptions = markerClusterOptions(),
230+
group = "Birds clusters") %>%
231+
# add birds layer
232+
addCircleMarkers(city_gbif_Aves$lat,
233+
city_gbif_Aves$long,
234+
radius = 3,
235+
fillColor = "green",
236+
color = "black",
237+
stroke = TRUE,
238+
weight = 0.8,
239+
fillOpacity = 0.6,
240+
popup = ~as.character(city_gbif_Aves$family),
241+
# label = label_birds2020,
242+
group = "Birds observations") %>%
243+
# Layers control
244+
addLayersControl(
245+
baseGroups = c("OSM","CartoDB"),
246+
overlayGroups = c("Birds observations","Birds clusters"),
247+
options = layersControlOptions(collapsed = FALSE)
248+
)
249+
```
250+
251+
## Baseline indicators
252+
253+
```{r Initialize_baseline, warning=FALSE, message=FALSE, echo = FALSE, eval = TRUE}
254+
# initialize empty dataframe for storing indicators
255+
biodiversity_indicators = data.frame(city_id = as.character(),
256+
indicator_name = as.character(),
257+
indicator_number = as.character(),
258+
value = as.numeric(),
259+
score = as.numeric())
260+
```
261+
262+
### I-1. Porportion of natural areas
263+
264+
Natural ecosystems contain more species than human-altered landscapes, hence, the higher the percentage of natural areas compared to that of the total city area gives an indication of the amount of biodiversity.
265+
266+
Natural ecosystems are defined as all areas that are natural and not highly disturbed or completely human-altered landscapes. Examples of natural ecosystems include forests, mangroves, freshwater swamps, natural grasslands, streams, lakes, etc. Parks, golf courses, roadside plantings are not considered as natural. However, natural ecosystems within parks where native species are dominant can be included in the computation.
267+
268+
This indicator is calculated as the percent of natural area within the city boundary: *(Total area of natural, restored and naturalised areas) ÷ (Area of city) × 100%*
269+
270+
Based on the assumption that,by definition, a city comprises predominantly human-altered landscapes, the maximum score will be accorded to cities with natural areas occupying more than 20% of the total city area.
271+
272+
```{r I1, warning=FALSE, message=FALSE, echo = FALSE, eval = TRUE}
273+
274+
natural_areas_classes = c('Trees','Shrubland','Grassland','Snow/ice','Open water','Herbaceous wetland',
275+
'Mangroves','Moss/lichen')
276+
277+
compute.i1 = function(city_id,city_worldcover_stat){
278+
279+
natural_areas_classes = c('Trees','Shrubland','Grassland','Snow/ice','Open water','Herbaceous wetland',
280+
'Mangroves','Moss/lichen')
281+
282+
biodiversity_indicators = city_worldcover_stat %>%
283+
mutate(natural_areas_class =
284+
case_when(`land cover class` %in% natural_areas_classes ~ "Natural areas",
285+
!`land cover class` %in% natural_areas_classes ~ "Non Natural areas")
286+
) %>%
287+
group_by(natural_areas_class) %>%
288+
summarise(natural_areas_percent = sum(`land percent`)) %>%
289+
filter(natural_areas_class == "Natural areas") %>%
290+
add_column(city_id = city_id,
291+
indicator_name = "Proportion of natural areas",
292+
indicator_number = "I1") %>%
293+
rename(value = natural_areas_percent) %>%
294+
mutate(score =
295+
case_when(value < 1 ~ "0",
296+
value <= 6.9 ~ "1",
297+
value <= 13.9 ~ "2",
298+
value <= 20 ~ "3",
299+
value > 20 ~ "4")) %>%
300+
dplyr::select(city_id,
301+
indicator_name,
302+
indicator_number,
303+
value,
304+
score)
305+
306+
return(biodiversity_indicators)
307+
}
308+
309+
310+
biodiversity_indicators = compute.i1(city_id = city_id,
311+
city_worldcover_stat = city_worldcover_stat)
312+
313+
# plot table
314+
biodiversity_indicators %>%
315+
kable() %>%
316+
kable_styling(bootstrap_options = c("striped", "hover"), full_width = F, font_size = 13)%>%
317+
scroll_box(width = "100%", height = "100px")
193318
```

0 commit comments

Comments
 (0)