Week 6 Context

Task 1: Import and visualise spatial data

What information does the dataset contain?

  • Which ID the field has, what crop is growing and the coordinates in metres.

What is the geometry type of the dataset (possible types are: Point, Lines and Polygons)?

  • Polygons

What are the data types of the other columns?

  • FieldID: double, Frucht: character

What is the coordinate system of the dataset?

  • Projected CRS: CH1903+ / LV95

Task 2: Annotate Trajectories from vector data

Select May and June.

# add a column month
wildschwein_BE$month = month(as.POSIXlt(wildschwein_BE$DatetimeUTC,
                                        format="%Y-%m-%d"), label=TRUE,
                             abbr=FALSE)

# filter for May and June
wild_summer <- wildschwein_BE |>
  filter(month == "May" | month == "June", .keep_all=TRUE)

# join with crop data
data_joined <- st_join(wild_summer, feld)

The following plot already shows that one of the wild boars (orange) resides in a different location than the other two.

Figure 1. Visualisation of crop data (polygons) and GPS tracks of wild boars in May and June.

Task 3: Explore annotated trajectories

Drop geometry. Create column hour. Aggregate column Frucht. Count data points on each Frucht polygon. Calculate percentage.

data_joined <- data_joined |>
  na.omit() |> 
  st_drop_geometry() |>
  mutate(hour = hour(round_date(DatetimeUTC, "hour")),
         Frucht_group = forcats::fct_lump(Frucht, 4)) |> 
  group_by(TierName, hour, Frucht_group) |>
  summarise(n=n()) |> 
  mutate(perc = n/sum(n))

Figure 2. Percentages of samples in a given crop per hour. Only showing the five most common categories.

Forest is preferred by all the wild boars. But whereas Ruth and Sabi also like wetlands, Rosa prefers barley.

Task 4: Import and visualise vegetationindex (raster data)

Figure 3. Landscape Vegetation Index / Vegetation Height.

Task 5: Annotate Trajectories from raster data

Figure 4. Vegetation height compared to date and separated by crop. There seems to be no pattern of height and date.

The following plot shows that Rosa and Sabi reside more in higher vegetation compared to Ruth.

Figure 5. Boxplots showing the vegetation high visited by the wild boars.

Change the column name as I couldn’t figure out how to change the legend title in the following plot.

colnames(wild_summer2)[colnames(wild_summer2)=="TierName"] <- "Wild Boar"

The following plot indicates again that the wild boar prefer higher vegetation but are not dependent on it (especially Rosa). I don’t know why there is a missing wild boar in the legend (used na.omit especially for that).

Figure 6. Vegetation height and GPS tracking points of three wild boars.