-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSemesterproject.Rmd
More file actions
678 lines (452 loc) · 35.6 KB
/
Semesterproject.Rmd
File metadata and controls
678 lines (452 loc) · 35.6 KB
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
---
title: "Spatial Analyses of wild boars data regarding on psycological patterns"
subtitle: "Semester Project for Patterns & Trends in Environmental Data FS22"
author: "Authors: Jonas Michael Windisch and Johannes Quente"
date: "Submission Date: 03.07.2022"
output:
html_document:
theme: journal
highlight: tango
toc: true
toc_float: true
code_download: true
output_dir: "docs"
code_folding: show
---
<style>
body {
text-align: justify;font-size: 17spx; line-height: 1.75em}
}
</style>
<style>
#TOC {
background: url("https://sges.ch/wp-content/uploads/2018/07/zhaw-iunr-logo.png");
background-size: contain;
padding-top: 250px !important;
background-repeat: no-repeat;
}
</style>
## Abstract
The threat of wild boar in cultural sites is becoming a greater problem in recent years. The understanding of wild boar activity patterns is therefore of use. Using the data of wild boar movement from 15.12.2014 until the 15.01.2015 has been evaluated in the following manner: Different environments like (settlements, streets and different land use categories) have been contextualized and rankings have been derived answering questions like “What does a wild boar fear?” and “What are the behavioral constraints of wild boars?”. Further we answered questions like what is the most active, laziest and the most adventurous wild boar. Therefore we derived semi scientific psychological patterns on the individual level to conduct rankings based on the answered questions.
## Introduction
In recent decades, an expansion and increase of wild boar (*Sus scrofa*) populations has been observed across Europe, with colonizing agricultural and urban areas, thus increasing problems of cohabitation with humans (Rutten et al., 2020). In particular, the wild boar often comes into conflict with humans, the main problems being the transmission of diseases to domestic animals and humans, collisions with vehicles, disturbance or threat to citizens and damage to gardens, public parks, pasture and agriculture (Meng et al. 2009).
Wild boar damage to croplands is expressed in different ways: direct consumption of crops, rooting in search of bulbs, invertebrates or tubers, seed removal, trampling and damage to agricultural infrastructure (Barrios-García & Ballari 2012). Therefore, it is important to know their activity patterns and where and when the wild boars are in order to take countermeasures.
The research question asked is: How can the different environments (settlements, streets and different land use categories) being contextualized with the activity-patterns of the wild boars. How can this be conceptualized, modeled and further implemented in suitable visualizations to show behavioral patterns given to a certain environmental context and help to answer questions like “What does wild boar fear?” or “What are the behavioral constraints of wild boars?”. Further we evaluated questions like what is the most active, laziest and the most adventurous wild boar. Finally we derived semi scientific psychological patterns on the individual level to conduct rankings based on the answered questions.
## Material and Methods
### Data Aquision and Preprocessing
For this project we needed the following data: wild boar data are given by the course administration of Patterns & Trends in Environmental Data, ZHAW, orthoimages & maps are given by swisstopo (open access) and the spatial data are given by geovite.ethz.ch (open access). An overview over the used data is given in table 1.
```{r message = FALSE, warning = FALSE}
library(knitr)
data_aquisistion <- data.frame(
Data = c("Wild-Boar", "Orthophoto", "Map", "TLM_Landcover", "TLM_Streets", "TLM_Railway", "TLM_Building", "TLM_LeisureAreas"),
Data_Format = c(".csv", ".tif", ".tif", ".geojson", ".geojson", ".geojson", ".geojson", ".geojson"),
Geometry_Type = c("Points", "Raster", "Raster", "Polygon", "Lines", "Lines", "Polygon", "Polygon"),
Projected_CRS = c("CH1903+ / LV95", "CH1903 / LV03", "CH1903 / LV03", "WGS 84", "CH1903 / LV03", "CH1903 / LV03", "CH1903 / LV03", "CH1903 / LV03")
)
kable(data_aquisistion, col.names = gsub("[_]", " ", names(data_aquisistion)), caption = "Table 1: Overwiev of the used data for this project.")
```
After loading the necessary libraries and the data acquisition in R (version 4.2.1), we converted their different coordinate reference system into a consistent one (CH1903+ / LV95). Then, the data are clipped to the study area with the extension of 2'567000/1'202000 to 2'573000/1'207000 with the function `st_intersection()`. The study area is located in the canton of Bern, district Seeland, Commune Gempelen and is located near the lake Neuchâtel. To reduce the amount of data volume - due to hardware limitation - only 7 of 19 wild boars were taken and the time period from 15.12.2014 until the 15.01.2015 was chosen. The result therefore is rather a simplified way to solve our question but includes all the necessary data to answer our research questions.
```{r message = FALSE, warning = FALSE , results = FALSE, fig.show = 'hide'}
### Loading Libraries:
library(devtools)
library(ComputationalMovementAnalysisData)
library(ggplot2)
library(readr)
library(dplyr)
library(terra)
library(sf)
library(tmap)
library(SimilarityMeasures)
library(lubridate)
library(tidyr)
library(knitr)
library(zoo)
library(data.table)
### Data Import:
Wildschwein_sf <- st_as_sf(wildschwein_BE, # Convert wild-boar csv-data in Spatial Object
coords = c("E", "N"),
crs = 2056)
Study_Area <- st_read("StudyArea.geojson") # Import Study Area
Orthophoto <- rast("Swissimage_1m_2014.tif") # Import Orthophoto as Raster-Data
Map <- terra::rast("Map_1to25000_2018.tif") # Import Map as Raster-Data
Feldfruechte <- st_read("Feldfruechte_1m_2021.geojson")
TLM_Bodenbedeckung <- st_read("TLM_Bodenbedeckung_2020.geojson") # Import Landcover-Types
TLM_Strassen <- st_read("TLM_Strassen_2020.geojson") # Import Roads
TLM_Eisenbahn <- st_read("TLM_Eisenbahn_2020.geojson") # Import Railway-Lines
TLM_Gebaeude <- st_read("TLM_Gebaeude_Foodprint_2020.geojson") # Import Buildings
TLM_Freizeitareale <- st_read("TLM_Freizeitareale_2020.geojson") # Import Leisure-Areas
### Convert CRS:
Wildschwein_sf # Projected CRS: CH1903+ / LV95
Study_Area # Projected CRS: CH1903+ / LV95
Orthophoto # Projected CRS: CH1903 / LV03
Map # Projected CRS: CH1903 / LV03
Feldfruechte # Projected CRS: CH1903+ / LV95
TLM_Bodenbedeckung # Projected CRS: WGS 84
TLM_Strassen # Projected CRS: CH1903 / LV03
TLM_Eisenbahn # Projected CRS: CH1903 / LV03
TLM_Gebaeude # Projected CRS: CH1903 / LV03
TLM_Freizeitareale # Projected CRS: CH1903 / LV03
TLM_Bodenbedeckung <- st_transform(TLM_Bodenbedeckung, crs = st_crs(2056))
TLM_Strassen <- st_transform(TLM_Strassen, crs = st_crs(2056))
TLM_Eisenbahn <- st_transform(TLM_Eisenbahn, crs = st_crs(2056))
TLM_Gebaeude <- st_transform(TLM_Gebaeude, crs = st_crs(2056))
TLM_Freizeitareale <- st_transform(TLM_Freizeitareale, crs = st_crs(2056))
Study_Area_for_Raster <- st_transform(Study_Area, crs = st_crs(21781))
### Objektart as Numeric:
TLM_Bodenbedeckung$objektart <- as.numeric(TLM_Bodenbedeckung$objektart)
TLM_Strassen$objektart <- as.numeric(TLM_Strassen$objektart)
TLM_Eisenbahn$objektart <- as.numeric(TLM_Eisenbahn$objektart)
TLM_Gebaeude$objektart <- as.numeric(TLM_Gebaeude$objektart)
TLM_Freizeitareale$objektart <- as.numeric(TLM_Freizeitareale$objektart)
### Downsizing Orthophoto
Orthophoto <- aggregate(Orthophoto, fact=2)
### Clip Data to Study_Area
Wildschwein_sf <- st_intersection(Wildschwein_sf, Study_Area)
Orthophoto <- crop(x = Orthophoto, y = Study_Area_for_Raster)
Feldfruechte <- st_intersection(Feldfruechte, Study_Area)
TLM_Bodenbedeckung <- st_intersection(TLM_Bodenbedeckung, Study_Area)
TLM_Strassen <- st_intersection(Study_Area, TLM_Strassen)
TLM_Eisenbahn <- st_intersection(Study_Area, TLM_Eisenbahn)
TLM_Gebaeude <- st_intersection(Study_Area, TLM_Gebaeude)
TLM_Freizeitareale <- st_intersection(Study_Area, TLM_Freizeitareale)
### Choose Wild-Boar Data from 2014 to 2015
Wildschwein_select <- Wildschwein_sf %>%
filter(DatetimeUTC >= as.Date("2014-12-15") & DatetimeUTC < as.Date("2015-01-15"))
timespan <- as.numeric(difftime(time1 = "2015-01-15", time2 = "2014-12-15", units = "secs"))
### Add Metadata
### Bodenbedeckung:
objektart <- c(1:15)
objektart_Beschreibung <- c("Fels", "Fels locker", "Felsbloecke", "Felsbloecke locker", "Fliessgewaesser", "Gebueschwald", "Lockergestein", "Lockergestein locker", "Gletscher", "Stehende Gewaesser", "Feuchtgebiet", "Wald", "Wald offen", "Gehoelzflaeche", "Schneefeld Toteis")
Attributnamen <- data.frame(objektart, objektart_Beschreibung)
TLM_Bodenbedeckung <-left_join(TLM_Bodenbedeckung, Attributnamen, by = "objektart")
### Strassen:
objektart <- c(1:23)
objektart_Beschreibung <- c("Ausfahrt", "Einfahrt", "Autobahn", "Raststaette", "Verbindung", "Zufahrt", "Dienstzufahrt", "10m Strasse", "6m Strasse", "4m Strasse", "3m Strasse", "Platz", "Autozug", "Faehre", "2m Weg", "1m Weg", "1m Wegfragment", "2m Wegfragment", "Markierte Spur","8m Strasse","Autostrasse","Klettersteig", "Provisorium")
Attributnamen <- data.frame(objektart, objektart_Beschreibung)
TLM_Strassen <-left_join(TLM_Strassen, Attributnamen, by = "objektart")
### Eisenbahn:
objektart <- c(0,2,4,5)
objektart_Beschreibung <- c("Normalspur", "Schmalspur", "Schmalspur mit Normalspur", "Kleinbahn")
Attributnamen <- data.frame(objektart, objektart_Beschreibung)
TLM_Eisenbahn <-left_join(TLM_Eisenbahn, Attributnamen, by = "objektart")
### Gebaeude:
objektart <- c(0:22)
objektart_Beschreibung <- c("Gebaeude", "NA", "Hochhaus", "Hochkamin", "Turm", "Kuehlturm", "Lagertank", "Lueftungsschacht", "Offenes Gebaeude", "Treibhaus", "Im Bau", "Kapelle", "Sakraler Turm", "Sakrales Gebaeude", "NA", "Flugdach", "Unterirdisches Gebaeude", "Mauer gross", "Mauer gross gedeckt", "Historische Baute", "NA", "NA", "Verbindungsbruecke")
Attributnamen <- data.frame(objektart, objektart_Beschreibung)
TLM_Gebaeude <-left_join(TLM_Gebaeude, Attributnamen, by = "objektart")
### Freizeitareale:
objektart <- c(0:7)
objektart_Beschreibung <- c("Campingplatzareal", "Freizeitanlagenareal", "Golfplatzareal", "Pferderennbahnareal", "Schwimmbadareal", "Sportplatzareal", "Standplatzareal", "Zooareal")
Attributnamen <- data.frame(objektart, objektart_Beschreibung)
TLM_Freizeitareale <-left_join(TLM_Freizeitareale, Attributnamen, by = "objektart")
```
### The most active or laziest wild boar
In order to find the most active, laziest or most adventurous individual, we derived the speed variable in order to find a proxy of the most active or laziest wild boar. Further we thought about another proxy of activeness: The net displacement to find the most adventurous individual over the entire study period (31 days). In this case to decided to derive the mean speed and mean displacement per one day intervals. In order to accomplish this task:
1. We rounded the date by days.
2. We grouped by "TierName" and "datetime_round".
3. We derived the speed and displacement by calculating mean speed (km/hours), step length (m/day) and net displacement (m/day).
4. Ranked each speed variable seperatly and from this the overall ranking with equal weighting was calculated.
5. Plotting the results with `geom_tile()`.
```{r message = FALSE, warning = FALSE , results = FALSE, fig.show = 'hide'}
ws_newyear <- wildschwein_BE %>%
filter(DatetimeUTC >= as.Date("2014-12-15") & DatetimeUTC < as.Date("2015-01-15"))
ws_newyear <- ws_newyear %>%
mutate(timelag = as.numeric(difftime(lead(DatetimeUTC),DatetimeUTC,units = "mins")))
ws_newyear_steplength <- ws_newyear %>%
group_by(TierName) %>%
mutate(
steplength = sqrt((E-lead(E))^2+(N-lead(N))^2)
)
ws_newyear_speed <- ws_newyear_steplength %>%
group_by(TierName) %>%
mutate(
speed = steplength/timelag
)
ws_newyear_net_displacement <- ws_newyear %>%
mutate(
net_displacement = sqrt((E-lead(E, 20))^2+(N-lead(N, 20))^2)
)
ws_newyear_speed %>%
subset(select=-c(E,N)) %>%
mutate(datetime_round = lubridate::round_date(as.POSIXct(DatetimeUTC),unit = "1 day")) %>%
group_by(TierName, datetime_round) %>%
summarise(speed_mean = mean(speed)) -> ws_newyear_speed_mean
ws_newyear_steplength %>%
subset(select=-c(E,N)) %>%
mutate(datetime_round = lubridate::round_date(as.POSIXct(DatetimeUTC),unit = "1 day")) %>%
group_by(TierName, datetime_round) %>%
summarise(steplength_mean = mean(steplength)) -> ws_newyear_steplength_mean
ws_newyear_net_displacement %>%
subset(select=-c(E,N)) %>%
mutate(datetime_round = lubridate::round_date(as.POSIXct(DatetimeUTC),unit = "1 day")) %>%
group_by(TierName, datetime_round) %>%
summarise(net_displacement = mean(net_displacement)) -> ws_newyear_net_displacement
```
### Moving Window Approach
The idea behind the “Moving Window Approach” is to reduce the noise (fluctuation) of the data. It therefore might be another approach to analyze i.e. the mean speed variable but was not been further elaborated in this project. The principal idea therefore is to sum up (in this case six and five) variables like mean speed to smooth out movement peeks (roll mean) over the given time period with the `rollmean()` function from the zoo package. This allows to visualize the movement patterns in a more trend driven way (Figure 1). Another idea would have been to derive the roll-mean of the individuals and compare the overall movement trends among each individual. This was not further been elaborated because of the following more aesthetic and better working approaches.
```{r message = FALSE, warning = FALSE, results='hide', fig.show = TRUE, fig.cap = "Figure 1: a) Moving Window Approach reduce the noise in the mean speed; b) Individual Approach."}
# Here we can see the overall movements of the seven wild boar in a smooth out way (derived by the rollmean function) and the original speedmean.
speed_mean <- ws_newyear_speed_mean %>%
head(100) %>%
mutate(rollmean = zoo::rollmean(speed_mean, 6, fill = NA, align = "center"))
speed_mean_long <- melt(setDT(speed_mean), id.vars = c("TierName","datetime_round"), variable.name = c("Mean"))
speed_mean_Plot <- ggplot(speed_mean_long, aes(x = datetime_round, y = value, color = Mean)) +
geom_line() +
theme_classic() +
labs(y = "Speed [km/h]", x = "Time") +
guides(color = guide_legend(title = "Analyse Approach")) +
scale_color_discrete(labels = c("Mean Speed", "Moving Window Approach"))
speed_mean_Plot
# The individual approach in order to possibly compare them among each other. In this case all combined in one line-graph.
# i.e.:
individual <- ws_newyear_speed_mean %>%
head(37) %>%
mutate(rollmean = zoo::rollmean(speed_mean, 5, fill = NA, align = "center"))
individual_Plot <- ggplot(individual, aes(x = datetime_round, y = rollmean, color = "TierName")) +
geom_line() +
theme_classic() +
labs(y = "Roll Mean [km/h]", x = "Time")
individual_Plot
```
### The most fearful and the most brave wild boar
To describe the effect of the human influence areas at the activity-patterns of the wild boars, the question was asked: What is the most fearful and the most brave wild boar? The "fearful" wild boar is defined as the animal which avoids urban areas. The "brave" wild boar is the one that ventures closest to settlements. The ranking was based on the time spent in human influence areas as a percentage over the entire study period (31 days).
To define the human influence areas - such as streets, railway, building and leisure areas - the data sets were first combined by `union()`. Then a buffer zone of 100 m was created around the human influence areas (`buffer()`). This range corresponds to the escape distance of 100 m to 200 m of wild boars given in the literature (Suter et al., 2018; Thurfjell et al. 2013). After joining the wild boar data with the Human Influence Areas Buffers (`st_join()`), the time difference between subsequent rows was calculated with `difftime()`. All categories of the urban areas were combined and named "Human Influence Areas" and all natural environment as "Nature". In Figure 2 a) are all human influence areas in the study area shown and in b) the 100 m buffer zone around the human influence areas.
```{r message = FALSE, warning = FALSE, results='hide', fig.show = TRUE}
### Combine Human Influence Areas.
### Geometry Type: Lines
Strassen_kl <- TLM_Strassen[,c("objektart_Beschreibung", "geometry")]
Eisenbahn_kl <- TLM_Eisenbahn[,c("objektart_Beschreibung", "geometry")]
Lines <- union(Strassen_kl, Eisenbahn_kl)
Lines <- st_as_sf(Lines)
### Geometry Type: Polygons
Gebaeude_kl <- TLM_Gebaeude[,c("objektart_Beschreibung", "geometry")]
Freizeitareale_kl <- TLM_Freizeitareale[,c("objektart_Beschreibung", "geometry")]
Polygons <- union(Gebaeude_kl, Freizeitareale_kl)
Polygons <- st_as_sf(Polygons)
### Total Human Influence Areas.
Human_Influence_Areas <- union(Lines, Polygons)
Human_Influence_Areas <- st_as_sf(Human_Influence_Areas)
### Create Buffer around Human Influence Areas.
Human_Influence_Areas_Buffer <- st_buffer(x = Human_Influence_Areas, dist = 100)
### Plot Human Influence Areas
Human_Influence_Areas_Plot <- tm_shape(shp = Orthophoto) +
tm_rgb() +
tm_shape(shp = Wildschwein_select) +
tm_dots(col = "TierName") +
tm_shape(shp = Human_Influence_Areas) +
tm_polygons(col = "objektart_Beschreibung") +
tm_lines(col = "objektart_Beschreibung") +
tm_compass(type = "arrow", position = c(0.247,0.028), bg.color = "white", bg.alpha = 0.75, size = 1.8) +
tm_scale_bar(breaks = c(0, 0.25, 0.5, 0.75 ,1), text.size = 0.75, position = c("left", "bottom"), bg.color = "white", bg.alpha = 0.75) +
tm_layout(main.title = "a)",
main.title.size = 1,
legend.title.size = 1,
legend.title.color = "white",
legend.text.size = 0.6,
legend.outside = TRUE,
legend.bg.color = "white",
legend.bg.alpha = 1)
Human_Influence_Areas_Buffer <- mutate(Human_Influence_Areas_Buffer,Human_Influence_Areas = "Human Influence Areas")
Human_Influence_Areas_Buffer_Plot <- tm_shape(shp = Orthophoto) +
tm_rgb() +
tm_shape(shp = Human_Influence_Areas_Buffer) +
tm_polygons(col = "Human_Influence_Areas", palette = "grey") +
tm_shape(shp = Wildschwein_select) +
tm_dots(col = "TierName") +
tm_compass(type = "arrow", position = c(0.247,0.028), bg.color = "white", bg.alpha = 0.75, size = 1.8) +
tm_scale_bar(breaks = c(0, 0.25, 0.5, 0.75 ,1), text.size = 0.75, position = c("left", "bottom"), bg.color = "white", bg.alpha = 0.75) +
tm_layout(main.title = "b)",
main.title.size = 1,
legend.title.size = 1,
legend.title.color = "white",
legend.text.size = 0.6,
legend.outside = TRUE,
legend.bg.color = "white",
legend.bg.alpha = 1)
### most fearful/brave wild boar
Wildboar_brave <- st_join(x = Wildschwein_select, y = Human_Influence_Areas_Buffer)
Wildboar_brave$objektart_Beschreibung <- replace_na(data = Wildboar_brave$objektart_Beschreibung, replace = "Wald&Wiesen&Natur")
Wildboar_brave <- mutate(Wildboar_brave, Human_Influence_Areas = if_else(objektart_Beschreibung == "Wald&Wiesen&Natur", "Natural Habitats", "Human Influence Areas"))
Wildboar_brave <- st_drop_geometry(Wildboar_brave)
Wildboar_brave <- mutate(Wildboar_brave,time_of_stay = as.integer(difftime(time1 = lead(DatetimeUTC), time2 = DatetimeUTC), units = "secs"))
Wildboar_brave <- Wildboar_brave[,c("TierName", "objektart_Beschreibung", "time_of_stay", "Human_Influence_Areas")]
Wildboar_brave_list <- Wildboar_brave %>%
filter(time_of_stay >0) %>%
group_by(TierName, Human_Influence_Areas) %>%
summarise(time_of_stay_s = sum(time_of_stay)) %>%
mutate(time_of_stay_percent = (time_of_stay_s/timespan)*100)
```
```{r message = FALSE, warning = FALSE, results='hide', fig.show = TRUE, fig.cap = "Figure 2: a) all human influence areas in the study area; b) the 100 m buffer zone around the human influence areas."}
Human_Influence_Areas_Plot
Human_Influence_Areas_Buffer_Plot
```
### Where wild boars stay
To describe the preferred locations - such as forest, water bodies, wetlands and farmland - the wild boar data and the land cover data were first joined by `st_join()`. Then the time difference between subsequent rows was calculated with `difftime()`. The classification was based on the time spent in the preferred locations as a percentage over the entire study period (31 days). In Figure 3 are all land cover types in the study area shown.
```{r message = FALSE, warning = FALSE, results='hide', fig.show = TRUE, fig.cap = "Figure 3: Land cover types in the study area."}
Wildboar_Bodenbedeckung <- st_join(x = Wildschwein_select, y = TLM_Bodenbedeckung)
Wildboar_Bodenbedeckung <- st_drop_geometry(Wildboar_Bodenbedeckung)
Wildboar_Bodenbedeckung$objektart_Beschreibung <- replace_na(data = Wildboar_Bodenbedeckung$objektart_Beschreibung, replace = "Ackerland")
Wildboar_Bodenbedeckung <- mutate(Wildboar_Bodenbedeckung,time_of_stay = as.integer(difftime(time1 = lead(DatetimeUTC), time2 = DatetimeUTC), units = "secs"))
Wildboar_Bodenbedeckung <- Wildboar_Bodenbedeckung[,c("TierName", "objektart_Beschreibung", "time_of_stay")]
Wildboar_Bodenbedeckung <- Wildboar_Bodenbedeckung %>%
filter(time_of_stay >0) %>%
group_by(TierName, objektart_Beschreibung) %>%
summarise(time_of_stay_s = sum(time_of_stay)) %>%
mutate(time_of_stay_percent = (time_of_stay_s/timespan)*100)
# Plot
Wildboar_LandCover_Plot <- tm_shape(shp = Orthophoto) +
tm_rgb() +
tm_shape(shp = TLM_Bodenbedeckung) +
tm_polygons(col = "objektart_Beschreibung") +
tm_shape(shp = Wildschwein_select) +
tm_dots(col = "TierName") +
tm_compass(type = "arrow", position = c(0.247,0.028), bg.color = "white", bg.alpha = 0.75, size = 1.8) +
tm_scale_bar(breaks = c(0, 0.25, 0.5, 0.75 ,1), text.size = 0.75, position = c("left", "bottom"), bg.color = "white", bg.alpha = 0.75) +
tm_layout(main.title.size = 1,
legend.title.size = 1,
legend.title.color = "white",
legend.text.size = 0.6,
legend.outside = TRUE,
legend.bg.color = "white",
legend.bg.alpha = 1)
Wildboar_LandCover_Plot
```
## Results
### The most active or laziest wild boar
The following are the core result of the question answered: which is the most active / laziest and the most adventurous wild boar. The results show clear "winners" and "losers" when having a look on the mean speed, mean step length and mean net displacement over the evaluated time period. We interpreted the results in the way, that the wild boar with the highest step length, speed or net displacement has been evaluated as the most active wild boar and vice versa. In order to support these findings, we also derived the overall mean speed and net displacement of each individual to back up our results and therefore finding the overall most active/laziest and the most adventurous wild boar.
```{r message = FALSE, warning = FALSE, results='hide', fig.show = TRUE, fig.cap = "Figure 4: a) Mean Speed; b) Mean Step Length; c) Net Displacement of the seven wild boars during the day (study period: 31 days)."}
# speed_mean
ws_newyear_speed_mean %>%
count(datetime_round, TierName) %>%
ggplot(mapping = aes(x = datetime_round, y = TierName)) +
geom_tile(mapping = aes(fill = ws_newyear_speed_mean$speed_mean)) +
theme_classic() +
labs(title = "a)", y = "Wild Boar Name", x = "Time") +
scale_fill_gradient(name = "Mean Speed [km/h]", low = "lightsalmon", high = "firebrick", na.value = "white")
# steplength_mean
ws_newyear_steplength_mean %>%
count(datetime_round, TierName) %>%
ggplot(mapping = aes(x = datetime_round, y = TierName)) +
geom_tile(mapping = aes(fill = ws_newyear_steplength_mean$steplength_mean)) +
theme_classic() +
labs(title = "b)", y = "Wild Boar Name", x = "Time") +
scale_fill_gradient(name = "Mean Step Length [m/day]", low = "lightsalmon", high = "firebrick", na.value = "white")
#net displacement
ws_newyear_net_displacement %>%
count(datetime_round, TierName) %>%
ggplot(mapping = aes(x = datetime_round, y = TierName)) +
geom_tile(mapping = aes(fill = ws_newyear_net_displacement$net_displacement)) +
theme_classic() +
labs(title = "c)", y = "Wild Boar Name", x = "Time") +
scale_fill_gradient(name = "Net Displacement [m/day]", low = "lightsalmon", high = "firebrick", na.value = "white")
```
The box plots in Figure 5 show the overall means of our indicators like speed/step length and net displacement of the individuals. According to the overall mean of net displacement, the winner seems to be the individual "Caroline." However, the overall winner therefore is the individual "Fritz" whereas he has the highest mean speed, step length and 2end biggest net displacement over the hole time period. The overall most laziest wild boar therefore seems to be the individual Sabine. The exact values are given in Table 2.
```{r message = FALSE, warning = FALSE, results='hide', fig.show = TRUE, fig.cap = "Figure 5: a) Mean Speed; b) Mean Step Length; c) Net Displacement of the seven wild boars overall the study period (31 days)."}
ggplot(data = ws_newyear_speed_mean, aes(x=TierName, y = speed_mean)) +
geom_boxplot() +
theme_classic() +
labs(title = "a)", y = "Mean Speed [km/h]", x = "Time")
ggplot(data = ws_newyear_steplength_mean, aes(x=TierName, y = steplength_mean)) +
geom_boxplot() +
theme_classic() +
labs(title = "b)", y = "Mean Step Length [m/day]", x = "Time")
ggplot(data = ws_newyear_net_displacement, aes(x=TierName, y = net_displacement)) +
geom_boxplot() +
theme_classic() +
labs(title = "c)", y = "Net Displacement [m/day]", x = "Time")
```
```{r message = FALSE, warning = FALSE}
ranking_speed <- ws_newyear_speed %>%
group_by(TierName) %>%
subset(select=-c(E,N)) %>%
summarise(Mean_Speed = round(mean(speed, na.rm =TRUE), digits = 2)) %>%
arrange(desc(Mean_Speed))
ranking_speed$Rank_speed <- 1:nrow(ranking_speed)
ranking_steplength <- ws_newyear_steplength %>%
group_by(TierName) %>%
subset(select=-c(E,N)) %>%
summarise(Mean_Step_Length = round(mean(steplength, na.rm =TRUE), digits = 0)) %>%
arrange(desc(Mean_Step_Length))
ranking_steplength$Rank_steplength <- 1:nrow(ranking_steplength)
ranking_displacement <- ws_newyear_net_displacement %>%
group_by(TierName) %>%
summarise(Net_Displacement = round(mean(net_displacement, na.rm =TRUE), digits = 0)) %>%
arrange(desc(Net_Displacement))
ranking_displacement$Rank_displacement <- 1:nrow(ranking_displacement)
R1 <- left_join(ranking_speed, ranking_steplength, by = "TierName")
R2 <- left_join(R1, ranking_displacement, by = "TierName")
R2 <- R2 %>%
group_by(TierName, Mean_Speed, Mean_Step_Length, Net_Displacement) %>%
mutate(Rank = Rank_speed + Rank_steplength + Rank_displacement) %>%
arrange(Rank)
R2$Wild_Boar_Name <- R2$TierName
Ranking_active <- R2[,c("Wild_Boar_Name", "Mean_Speed", "Mean_Step_Length", "Net_Displacement", "Rank")]
Ranking_active$Rank <- 1:nrow(Ranking_active)
kable(Ranking_active, col.names = gsub("[_]", " ", names(Ranking_active)), caption = "Table 2: The exact values and the ranking for the most active wild boar (Mean Speed [km/h], Mean Step Length [m/day], Net Displacement [m/day]) overall the study period (31 days).")
```
### The most fearful and the most brave wild boar
The effect of the human influence areas at the activity-patterns of the wild boars is shown in Figure 4. The duration of stay in urban areas is different for each animal. It is clearly seen, that the wild boars "Sabine" and "Ruth" venture closest to settlements. Whereas "Isabelle" and "Rosa" avoid the human influence areas and and prefer to stay in nature. The exact values and the ranking for each wild boar are given in Table 3 & 4.
```{r message = FALSE, warning = FALSE, results='hide', fig.show = TRUE, fig.cap = "Figure 6: Time stay in human influence areas and nature as a percentage over the entire study period (31 days) of the seven wild boars."}
# Plot
Wildboar_brave_list_plot <- ggplot(Wildboar_brave_list, aes(x = TierName, y = time_of_stay_percent, fill = Human_Influence_Areas)) +
geom_col() +
theme_classic() +
labs(y = "Duration of Stay [%]", x = "Wild Boar Name") +
guides(fill=guide_legend(title="Land Type")) +
scale_fill_manual(values = c("grey", "firebrick"))
Wildboar_brave_list_plot
```
```{r message = FALSE, warning = FALSE}
# Ranking brave
Wildboar_brave_rank <- Wildboar_brave_list %>%
group_by(TierName) %>%
filter(Human_Influence_Areas == "Human Influence Areas") %>%
arrange(desc(time_of_stay_percent))
Wildboar_brave_rank$Rank <- 1:nrow(Wildboar_brave_rank)
Wildboar_brave_rank$Wild_Boar_Name <- Wildboar_brave_rank$TierName
Wildboar_brave_rank$Duration_of_Stay <- Wildboar_brave_rank$time_of_stay_percent
Wildboar_brave_rank <- Wildboar_brave_rank[,c("Wild_Boar_Name", "Duration_of_Stay", "Rank")]
Wildboar_brave_rank$Duration_of_Stay <- round(Wildboar_brave_rank$Duration_of_Stay, digits = 0)
kable(Wildboar_brave_rank, col.names = gsub("[_]", " ", names(Wildboar_brave_rank)), caption = "Table 3: The exact values and the ranking for the brave wild boar (Duration of Stay in Percent).")
# Ranking fearful
Wildboar_fearful_rank <- Wildboar_brave_list %>%
group_by(TierName) %>%
filter(Human_Influence_Areas == "Natural Habitats") %>%
arrange(desc(time_of_stay_percent))
Wildboar_fearful_rank$Rank <- 1:nrow(Wildboar_fearful_rank)
Wildboar_fearful_rank$Wild_Boar_Name <- Wildboar_fearful_rank$TierName
Wildboar_fearful_rank$Duration_of_Stay <- Wildboar_fearful_rank$time_of_stay_percent
Wildboar_fearful_rank <- Wildboar_fearful_rank[,c("Wild_Boar_Name", "Duration_of_Stay", "Rank")]
Wildboar_fearful_rank$Duration_of_Stay <- round(Wildboar_fearful_rank$Duration_of_Stay, digits = 0)
kable(Wildboar_fearful_rank, col.names = gsub("[_]", " ", names(Wildboar_fearful_rank)), caption = "Table 4: The exact values and the ranking for the fearful wild boar (Duration of Stay in Percent).")
```
### Where wild boars stay
The preferred locations of wild boars are very different and individual. "Sabine" and "Ruth" for example are water-loving, staying mostly in water bodies and wetlands. Whereas "Caroline" and "Fritz" are more in woods and farmlands. Over all, wetlands are the most popular location for every wild boar. The time stay in the land cover types is shown in Figure 5.
```{r message = FALSE, warning = FALSE, results='hide', fig.show = TRUE, fig.cap = "Figure 7: Time stay in the land cover types as a percentage over the entire study period (31 days) of the seven wild boars."}
Wildboar_LandType_Plot <- ggplot(Wildboar_Bodenbedeckung, aes(x = TierName, y = time_of_stay_percent, fill = objektart_Beschreibung)) +
geom_col() +
theme_classic() +
labs(y = "Duration of Stay [%]", x = "Wild Boar Name") +
guides(fill=guide_legend(title="Land Type")) +
scale_fill_brewer(palette = 14)
Wildboar_LandType_Plot
```
## Discussion
**Results and discussion of the research questions. Achievements and further steps.**
In order to reduce the amount of data we chose 7 individuals over the time period of 15.12.2014 until the 15.01.2015. Our core results are the questions answered: Which is the most active / laziest and most adventurous wild boar. We therefore contextualized behavioral patterns given to a certain environment type (i.e. field, forest, settlement area) and answered the following questions: “What does a wild boar fear?” or “What are the behavioral constraints of wild boars?”.
The results showed clear "winners" and "losers" when having a look on the mean speed, mean step length and mean net displacement over the evaluated time period. We therefore interpreted the results in the way that the wild boar with the highest step length, speed got evaluated as the most active wild boar and vice versa. The wild boar with the highest net displacement got evaluated as the most adventurous.
The box plots show the overall mean proxies of our indicator like speed/step length and net displacement of the individuals. They seem to be the most adequate ways to visualize the overall activeness. The overall winner therefore seems to be the individual Fritz whereas he has the highest mean speed, step length and net displacement over the hole time period chosen. The overall laziest wild boar therefore seems to be the wild boar individual Sabine.
Interestingly whereas according to the overall mean of net displacement the winner seems to be the individual Caroline. We therefore added the title of the most adventurous wild boar equaling the most traveled wild boar to the individual Caroline.
The effect of the human influence areas at the activity-patterns of the wild boars is shown in Figure 2. The duration of close approximation to urban areas is different for each animal. The wild boars “Sabine” and “Ruth” venture closest to settlements. Whereas “Isabelle” and “Rosa” avoid close approximation to urban areas and prefer to stay in more remote areas like fields and forest. The exact values and the ranking for each wild boar are given in table 2 & 3.
Further steps for future research would be clearly to broaden the time period and therefore extending the number of individuals. The mean values could therefore be more informative because them bearing more overall information. Also, the contextualized movement patterns would expand the valuable number of psychological patterns because considering more overall data.
**Report problems, limitations and solutions**
The interpretation of what most "active" / "laziest" or “adventurous” means still remains a vague idea but in this project, we defined it as the fastest or most traveled wild boar over the given time period.
The Moving window approach in order to reduce noise of the data might have been another approach to analyze i.e. mean speed but was not further been elaborated in this project. The idea was to sum up – in this case six and five over the day mean variables like speed to smooth out movement peeks over the hole given time period of one month. This allows to visualize the movement patterns in a more trend driven way.
**Data science choices**
The derivation of speed, steplenght and net displacement has been done according to the theory covered in the lectures.
## Bibliography
M. Noelia Barrios-Garcia, Sebastian A. Ballari, "Impact of wild boar (Sus scrofa) in its introduced and native range: a review", Biol Invasions, vol, 14, pp. 2283–2300, 2012, https://link.springer.com/content/pdf/10.1007/s10530-012-0229-6.pdf.
X. J. Meng, D. S. Lindsay, and N. Sriranganathan, "Wild boars as sources for infectious diseases in livestock and humans", Philosophical Transactions of the Royal Society B: Biological Sciences, vol. 364, no. 1530, pp. 2697–2707, 2009, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2865094/pdf/rstb20090086.pdf.
Anneleen Rutten, Jim Casaer, Diederik Strubbe and Herwig Leirs, "Agricultural and landscape factors related to increasing wild boar agricultural damage in a highly anthropogenic landscape", Wildlife Biology, vol. 2020, no. 1, pp. 1-11, 2020, https://onlinelibrary.wiley.com/doi/pdf/10.2981/wlb.00634.
Henrik Thurfjell, Göran Spong & Göran Ericsson, "Effects of hunting on wild boar Sus scrofa behaviour", Wildlife Biology, vol. 2020, no. 19, pp. 87-93, 2020, https://bioone.org/journals/wildlife-biology/volume-19/issue-1/12-027/Effects-of-hunting-on-wild-boar-Sus-scrofa-behaviour/10.2981/12-027.pdf.
Suter Stefan, Sandro Stoller & Benjamin Sigrist, "Prävention von Wildschweinschäden in der Landwirtschaft und Management von Wildschweinen in Schutzgebieten", Schlussbericht, 2018, https://www.zhaw.ch/storage/hochschule/medien/bildmaterial/Schlussbericht_Wildschweinschreck.pdf.