16 Read and use
16.1 Read Geolocator Data Package
A cool feature of Zenodo is that you can load the data directly without downloading the files!
pkg <- read_gldp("https://zenodo.org/records/14641765/files/datapackage.json")
16.2 Analyse data with GeoPressureTemplate
If this data package has not yet been analysed with GeoPressureR, you can create a GeoPressureTemplate folder from the data package using the following code. Note that this code will open a new RStudio session.
project_dir <- create_geopressuretemplate(path = tempfile(), pkg = pkg)
✔ Cloning repo from <https://github.com/Rafnuss/GeoPressureTemplate/> into
'/private/var/folders/cm/dh8lmmxn3b5bcb2_gbz16ycm0000gn/T/RtmpccuXNA/file1200bbdc264e/'.
✔ Setting active project to
"/private/var/folders/cm/dh8lmmxn3b5bcb2_gbz16ycm0000gn/T/RtmpccuXNA/file1200bbdc264e".
✔ Adding "CC BY 4.0" to 'License'.
✔ Writing 'LICENSE.md'.
⠙ 4/5 ETA: 1s |
Note
At this stage, you’ll need to go through all the steps to make yourself at home.
You’re now ready to analyse your data according to the GeoPressureTemplate instructions!
16.3 Use analysed data
If the datapackage you want to use has already been analysed, you can retrieve all the resources of the datapackage:
# List available resources
print(pkg)
── A GeoLocator Data Package (v0.2)
• title: "GeoLocator Data Package: South African Woodland Kingfisher"
• contributors:
Nussbaumer, Raphaël (contactperson) - <https://orcid.org/0000-0002-8185-1020>
Rime, Yann (researcher) - <https://orcid.org/0009-0005-7264-6753>
Osinubi, Samuel Temidayo (datacollector) -
<https://orcid.org/0000-0002-5143-6985>
• embargo: 1970-01-01
• licenses: Creative Commons Attribution 4.0 International (cc-by-4.0) -
<https://creativecommons.org/licenses/by/4.0/legalcode>
• id: <https://doi.org/10.5281/zenodo.13829929>
• description: "<p>This repository contains the raw data and the trajectory
information generated with the GeoPressureR workflow, following the <a
href=\"https://raphaelnussbaumer.com/GeoLocator-DP/\">GeoLocator Data Package
standard</a>. The more complete code used to generate this datapackage can be
found on the Github Repository <a
href=\"https://github.com/Rafnuss/WoodlandKingfisher\">Rafnuss/WoodlandKingfisher</a>. </p>
<p>It contains 5 tags equipped on Woodland Kingfisher in Mogalakwena,
Limpopo, South Africa between 2017-2020.</p> <p> </p>"
• version: "v1.2.0"
• relatedIdentifiers:
• keywords: "Woodland Kingfisher", "multi-sensor geolocator", "intra-african
migration", "bird", and "migration"
• created: 2024-11-12
• spatial: Polygon and c(17.375, 32.875, 32.875, 17.375, 17.375, -24.375,
-24.375, 12.875, 12.875, -24.375)
• temporal: "2017-01-10" to "2019-09-28"
• taxonomic: "Halcyon senegalensis"
• numberTags:
tags: 25
measurements: 5
light: 5
pressure: 5
activity: 5
temperature_external: 5
magnetic: 5
paths: 5
pressurepaths: 5
── 8 resources:
• twilights
• staps
• paths
• edges
• pressurepaths
• tags
• observations
• measurements
Use `unclass()` to print the Geolocator Data Package as a list.
tag_id | stap_s | stap_t | lat_s | lon_s | lat_t | lon_t | s | t | j | start | end | n | distance | bearing | gs_u | gs_v | ws_u | ws_v |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16LN | 1 | 2 | -22.7 | 28.8 | -20.1 | 26.6 | 8503 | 21109 | 1 | 2017-04-04 19:42:30 | 2017-04-05 03:52:30 | 1 | 363.6 | -38.1 | -26.9 | 31.4 | -28.0 | -3.5 |
16LN | 2 | 3 | -20.1 | 26.6 | -18.9 | 26.4 | 21109 | 34936 | 1 | 2017-04-05 17:37:30 | 2017-04-05 21:12:30 | 1 | 140.8 | -10.8 | -6.0 | 31.7 | -13.8 | -1.0 |
16LN | 3 | 4 | -18.9 | 26.4 | -18.1 | 27.1 | 34936 | 49373 | 1 | 2017-04-06 01:02:30 | 2017-04-06 03:42:30 | 1 | 114.7 | 43.8 | 23.0 | 24.0 | -2.3 | -0.1 |
16LN | 4 | 5 | -18.1 | 27.1 | -17.1 | 26.6 | 49373 | 63049 | 1 | 2017-04-06 23:52:30 | 2017-04-07 03:07:30 | 1 | 122.7 | -25.7 | -12.9 | 26.9 | -16.9 | -9.8 |
16LN | 5 | 6 | -17.1 | 26.6 | -17.1 | 27.4 | 63049 | 77489 | 1 | 2017-04-07 18:17:30 | 2017-04-07 21:12:30 | 1 | 79.8 | 90.1 | 18.2 | 0.0 | -9.5 | -3.5 |
16LN | 6 | 7 | -17.1 | 27.4 | -15.6 | 25.6 | 77489 | 90403 | 1 | 2017-04-08 17:37:30 | 2017-04-08 22:17:30 | 1 | 250.0 | -48.6 | -36.0 | 31.7 | -23.2 | 3.4 |
Here is an example showing all the tracks
Code
bird_data <- paths(pkg) %>%
filter(type == "most_likely")
# Generate a color palette for unique tag IDs
tag_ids <- unique(bird_data$tag_id)
color_palette <- colorFactor(palette = "Set1", domain = tag_ids)
leaflet_map <- leaflet(height = 600) %>% addTiles()
# Add polylines and markers for each tag_id
for (tag in tag_ids) {
bird_subset <- bird_data %>% filter(tag_id == tag)
leaflet_map <- leaflet_map %>%
addPolylines(
lng = ~lon,
lat = ~lat,
data = bird_subset,
color = color_palette(tag),
weight = 2,
popup = ~ paste0("Tag ID: ", tag_id, "<br>Step: ", stap_id)
) %>%
addCircleMarkers(
lng = ~lon,
lat = ~lat,
data = bird_subset,
color = color_palette(tag),
radius = 4,
fillOpacity = 0.8,
popup = ~ paste0("Tag ID: ", tag_id, "<br>Step: ", stap_id)
)
}
# Add a legend
leaflet_map <- leaflet_map %>%
addLegend(
position = "topright",
pal = color_palette,
values = tag_ids,
title = "Bird Trajectories",
opacity = 1
)
# Display the map
leaflet_map