Downloads all photos from a data frame returned by inat_fetch(), and optionally saves observation metadata to a CSV file in the same folder.

inat_download(
  obs,
  out_dir,
  size = "large",
  metadata = TRUE,
  overwrite = FALSE,
  verbose = TRUE
)

Arguments

obs

Data frame returned by inat_fetch().

out_dir

Character. Directory to save images and metadata. Created if it does not exist. There is no default: you must specify a path, e.g. a folder in your working directory or tempdir() for a temporary location.

size

Character. Photo size: "square" (75px), "small" (240px), "medium" (500px), "large" (1024px), or "original". Default "large". The size is appended to the filename (e.g. obs123_456_large.jpg).

metadata

Logical. If TRUE (default), automatically saves a metadata.csv file to out_dir alongside the downloaded photos.

overwrite

Logical. Re-download files that already exist (default FALSE).

verbose

Logical. Print progress messages (default TRUE).

Value

Invisibly returns a data frame of photo URLs and local file paths.

Examples

if (FALSE) { # \dontrun{
obs <- inat_fetch(taxon_id = 488444, place_id = 6783,
                  user_login = "someuser")

# Download photos and save metadata.csv to the same folder
inat_download(obs, out_dir = file.path(tempdir(), "my_photos"))

# Download photos only, no metadata
inat_download(obs, out_dir = file.path(tempdir(), "my_photos"),
              metadata = FALSE)
} # }