Skip to content

Instantly share code, notes, and snippets.

@damianooldoni
Last active March 20, 2023 12:59
Show Gist options
  • Save damianooldoni/b16608eef989aa17a296adcaa71537e5 to your computer and use it in GitHub Desktop.
Save damianooldoni/b16608eef989aa17a296adcaa71537e5 to your computer and use it in GitHub Desktop.
How to trigger a download of occurrences at regional level (Brussels) for EU IAS derived list via rgbif (3.7.5).
library(rgbif)
# specify keys of interest
taxon_key_key <- "taxonKey"
taxon_key_value <- c(2978552, # EU - IAS list
2489005,
3190653,
2498252,
3084923,
2340977,
2706080,
2502792,
3170247,
2440934,
3129663,
2882443,
2437394,
2437399,
3189935,
3169169,
4284921,
2704521,
2482499,
2702865,
2765942,
5329212,
2225776,
8979506,
5712056,
2350580,
2350570,
2984306,
6063677,
7287606,
3034825,
3628745,
3628608,
2434271,
2984537,
3034613,
2891770,
8848208,
2865565,
9799308,
2394486,
8114276,
5855350,
2427091,
5421039,
5420991,
2650436,
2869311,
5289808,
2394604,
2440946,
4264680,
5361785,
5361762,
2433536,
2434552,
5219858,
8909595,
8971201,
2498305,
2226990,
3086784,
5828232,
2390064,
4033648,
2870583,
7965247,
2227300,
9442269,
5218786,
5358460,
2362868,
2977647,
2486131,
5824863,
5274863,
5219681,
5219683,
5035187,
5035230,
5035017,
2437450,
2480764,
2443002,
3054399,
1311477,
1315391,
5217334)
country_key <- "country"
country_value <- "BE"
gadm_gid_key <- "gadm"
gadm_gid_value <- "BEL.1_1"
basis_of_record_key <- "basisOfRecord"
# no "LIVING_SPECIMEN" and "FOSSIL_SPECIMEN"
basis_of_record_value <- c(
"OBSERVATION",
"HUMAN_OBSERVATION",
"MATERIAL_SAMPLE",
"LITERATURE",
"PRESERVED_SPECIMEN",
"UNKNOWN",
"MACHINE_OBSERVATION"
)
# trigger a GBIF download
gbif_download <- rgbif::occ_download(
pred_in(key = taxon_key_key,
value = taxon_key_value),
pred(key = country_key,
value = country_value),
pred(key = gadm_gid_key,
value = gadm_gid_value),
pred_in(key = basis_of_record_key,
value = basis_of_record_value)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment