WildObsR finds, downloads and prepares camera trap data from WildObs, Australia’s national wildlife camera database. Every project arrives as a Camera Trap Data Package (Camtrap DP), which contains tables of camera deployments, observations, media, and a WildObs-generated table containing spatio-temporal covariates for each camera deployment, along with the Creative Commons licences, formatted citation and field definitions that travel with the data package. This vignette takes you from installation to your first downloaded data package in about ten lines of code.
Install WildObsR
WildObsR is installed from GitHub:
# install.packages("pak")
pak::pak("WildObs/WildObsR")remotes::install_github("WildObs/WildObsR") works too.
WildObsR relies on the spatial package sf, which needs the
GDAL, PROJ and GEOS libraries. On Windows and macOS they come with
sf itself. On Linux, install them first, for example
sudo apt install libgdal-dev libproj-dev libgeos-dev libssl-dev
on Ubuntu.
To install a particular release rather than the latest version, add
its tag, for example
pak::pak("WildObs/WildObsR@v0.2.0").
Get an API key
Database access requires a personal API key, tied to your own WildObs account. API keys are generated per-user, not per-project. All API keys provides access to the public WildObs Database, where sensitive species records are obscured and data sharing agreements are applied. Therefore, each API key delivers the same data for everyone.
- Create an account or log in at the WildObs Dashboard.
- Note that if you have submitted data to the WildObs Database, please create an account using the same email address you used to share data to ensure you have access to your private unobscured data.
- Under WildObs Database, select Get Started to open the database page.
- In the panel at the top right, select Create under API Key, and copy the key. Treat it like a password: do not share it or paste it into a script.
- Store it in your
.Renvironfile, which R reads when it starts, so the key stays out of your code. Open the file withusethis::edit_r_environ(), add the line below with your own key, save it and restart R.
WILDOBSR_API_KEY=your_key_here
Paste the key without quotes or spaces after the =, and
end the file with a blank line, or R ignores the last entry. Then read
the key into your session:
library(WildObsR)
# read the key from .Renviron; it is never printed
api_key <- Sys.getenv("WILDOBSR_API_KEY")
# Check that R has found it, should return TRUE
nzchar(api_key)
#> [1] TRUEIf this returns FALSE, check the spelling of
WILDOBSR_API_KEY and that you restarted your R session.
Find projects
wildobs_mongo_query() is a quick and light-weight
function that queries the metadata of all projects along multiple
parameters and returns the IDs of those that match. Filters include
where in space camera were active, time surveys were collecting data,
species detected in the survey, camera deployment sampling designs, and
contributors associated with each project. Multiple filters can be
combined, and the projects that are returned must match all of them.
Here we look for projects in a spatial box around the Wet Tropics
Rainforests of Far North Queensland that list Zachary Amir as a
contributor:
# a box around the Wet Tropics, in latitude and longitude (i.e., decimal degrees)
wet_tropics <- list(xmin = 144.9, xmax = 146.5, ymin = -19.6, ymax = -15.3)
# find every project with cameras inside the box and Zachary Amir among its contributors
ids <- wildobs_mongo_query(api_key = api_key, spatial = wet_tropics,
contributors = "Zachary Amir")
# check which project IDs were returned
ids
#> [1] "ZAmir_QLD_Wet_Tropics_2022_WildObsID_0001"Leave out contributors to see every project in the
box.
By default the search returns two kinds of projects:
-
Open projects, which have no remaining embargo
period, contain all available data tables.
- Include
tabularSharingPreference = "open"inwildobs_mongo_query()to find only projects you can download in full.
- Include
- Partial projects have a remaining embargo period, and only contain their project-level metadata. This data is useful for discovering projects and providing information such as where, when and who collected the data.
You can learn more about WildObs’s data sharing agreements here.
Download them
wildobs_dp_download() returns a named list with one data
package per project. Media tables, which record one row per camera trap
image or video are by far the largest table, and the default behavior of
this function is to leave it out unless you ask for
media = TRUE.
# one data package per project, without the media table
dp_list <- wildobs_dp_download(api_key = api_key, project_ids = ids)
# count how many tables each package holds; a partial project holds none
vapply(dp_list, function(dp) length(dp$resources), integer(1))
#> ZAmir_QLD_Wet_Tropics_2022_WildObsID_0001
#> 3Each package holds its tables as Frictionless Data
Package resources. Read them with
frictionless::read_resource(), which returns each column
with the type its schema defines, and formats date-times in the
project’s own time zone. The package also keeps a copy in
dp$data, because the camtrapdp class expects
one, but other tools do not always keep that copy up to date, so read
tables with read_resource().
# the first open project
dp <- dp_list[["ZAmir_QLD_Wet_Tropics_2022_WildObsID_0001"]] # or dp_list[[1]]
# read the camera deployments table, one row per camera deployment
deployments <- frictionless::read_resource(dp, "deployments")
# inspect a few key fields
head(deployments[, c("deploymentID", "locationName", "deploymentStart", "deploymentEnd")])
#> # A tibble: 6 × 4
#> deploymentID locationName deploymentStart deploymentEnd
#> <chr> <chr> <dttm> <dttm>
#> 1 CFRAG_01_WildObsID_0001_… Eacham_Curt… 2022-12-15 08:52:45 2023-02-15 10:46:32
#> 2 CFRAG_01_WildObsID_0001_… Eacham_Curt… 2022-12-15 08:19:27 2023-03-06 13:29:49
#> 3 CFRAG_02_WildObsID_0001_… Eacham_Curt… 2022-12-15 09:58:36 2023-02-12 06:42:14
#> 4 CFRAG_02_WildObsID_0001_… Eacham_Curt… 2022-12-15 09:40:56 2023-03-07 14:11:01
#> 5 CFRAG_03_WildObsID_0001_… Eacham_Curt… 2022-12-15 11:00:58 2023-03-06 15:18:39
#> 6 CFRAG_03_WildObsID_0001_… Eacham_Curt… 2022-12-15 10:36:47 2023-03-03 23:08:06
# read the observations table
observations <- frictionless::read_resource(dp, "observations")
# inspect what types of observations are contained in this table
sort(table(observations$observationType))
#>
#> unclassified unknown human vehicle animal blank
#> 0 8 14832 16641 33522 65679Set obscured records aside
Records of threatened species are obscured where the species is
listed under the Environment Protection and Biodiversity
Conservation Act 1999. They keep the species, date and count, but
the foreign keys that link back to both the deployments, media, and
covariates tables read
obscured_for_<category>_species, so they cannot be
joined. Count them, then set them aside before any spatial analysis:
Read the metadata, and cite the data
extract_metadata() turns the metadata of one or many
packages into tables, such as who collected the data, under which
licence, and with what sampling design. cite_datapackages()
provides citations formatted by WildObs, including each dataset’s
Research Activity Identifier (RAiD),
which provides a persistent identifier to reference data used in
research. Additional parameters allow you to include the data package
version you downloaded and citations for the WildObs-generated
covariates table.
# the licence of every project
extract_metadata(dp_list, "licenses")[, c("name", "scope", "DPID")]
#> name scope DPID
#> 1 CC-BY-4.0 data ZAmir_QLD_Wet_Tropics_2022_WildObsID_0001
#> 2 CC-BY-4.0 media ZAmir_QLD_Wet_Tropics_2022_WildObsID_0001
# the references to cite, one per project
writeLines(cite_datapackages(dp_list))
#> Zachary Amir, Tom Bruce & Matthew Luskin (2022). WildObs Camera Trap Data Package: Zachary Amir's camera trap surveys from 6 national parks in QLD's Wet Tropics rainforests from late 2022 to early 2023 targeting feral and native vertebrates [Camera Trap Data Package]. WildObs National Wildlife Camera Database. https://wildobs.org.au. RAiD: https://raid.org/10.83062/cb5829ab. WildObs data package version 1.2.0.Work offline with the example data
Two open projects ship with WildObsR, so you can try every function
without a key or an internet connection.
example_datapackages() returns them in the same shape as
wildobs_dp_download(), with animal detections only and no
media table:
# the bundled copies of two projects
examples <- example_datapackages()
names(examples)
#> [1] "ZAmir_QLD_Wet_Tropics_2022_WildObsID_0001"
#> [2] "NSW_Woomargama_wombats_Linley_2021-22_WildObsID_0010"Where to next
- Discover what exists searches the database in more depth and cites what you find.
- Inside a WildObs data package explains each table and field, and where WildObs differs from the Camtrap DP standard.
- Camtrap DP interoperability exports WildObs data for the camtrapdp and camtrapR packages and for GBIF.
WildObsR checks its own version the first time you query or download data in a session, and warns if a newer release is available. Update by reinstalling as above.
Session information
sessionInfo()
#> R version 4.5.1 (2025-06-13)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS Tahoe 26.5.1
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
#>
#> locale:
#> [1] C.UTF-8/C.UTF-8/C.UTF-8/C/C.UTF-8/C.UTF-8
#>
#> time zone: Australia/Brisbane
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] WildObsR_0.3.0.9000 here_1.0.1
#>
#> loaded via a namespace (and not attached):
#> [1] stringdist_0.9.17 xfun_0.61 devtools_2.4.6 remotes_2.5.0
#> [5] lattice_0.22-7 tzdb_0.5.0 vctrs_0.7.3 tools_4.5.1
#> [9] generics_0.1.4 curl_8.0.0 parallel_4.5.1 tibble_3.3.1
#> [13] proxy_0.4-29 cluster_2.1.8.1 chron_2.3-63 pkgconfig_2.0.3
#> [17] Matrix_1.7-3 KernSmooth_2.23-26 desc_1.4.3 lifecycle_1.0.5
#> [21] compiler_4.5.1 stringr_1.6.0 terra_1.9-50 codetools_0.2-20
#> [25] permute_0.9-10 usethis_3.2.1 class_7.3-23 crayon_1.5.3
#> [29] pillar_1.11.1 tidyr_1.3.2 MASS_7.3-65 ellipsis_0.3.2
#> [33] classInt_0.4-11 mongolite_4.1.0 cachem_1.1.0 vegan_2.7-6
#> [37] sessioninfo_1.2.3 nlme_3.1-168 tidyselect_1.2.1 stringi_1.8.9
#> [41] sf_1.1-3 dplyr_1.2.1 purrr_1.2.2 splines_4.5.1
#> [45] rprojroot_2.1.1 fastmap_1.2.0 grid_4.5.1 cli_3.6.6
#> [49] magrittr_2.0.5 utf8_1.2.6 pkgbuild_1.4.8 e1071_1.7-17
#> [53] withr_3.0.3 readr_2.2.0 bit64_4.8.6 lubridate_1.9.5
#> [57] timechange_0.4.0 httr_1.4.9 ozmaps_0.4.5 bit_4.6.0
#> [61] otel_0.2.0 lutz_0.3.2 hms_1.1.4 memoise_2.0.1
#> [65] evaluate_1.0.5 knitr_1.52 mgcv_1.9-3 frictionless_1.3.0
#> [69] rlang_1.3.0 Rcpp_1.1.2 glue_1.8.1 DBI_1.3.0
#> [73] geojsonsf_2.0.5 pkgload_1.4.1 vroom_1.7.1 rstudioapi_0.17.1
#> [77] jsonlite_2.0.0 R6_2.6.1 plyr_1.8.9 oz_1.0-22
#> [81] fs_1.6.6 units_1.0-1