Extracts key fields from observations returned by inat_fetch() and writes them to a CSV file. Use path to save the CSV in the same folder as your downloaded photos.

inat_metadata(obs, path, extra_cols = NULL)

Arguments

obs

Data frame returned by inat_fetch().

path

Character. Output CSV file path. There is no default: you must specify a path, e.g. a file in your working directory or tempfile(fileext = ".csv") for a temporary location. To save alongside downloaded photos, use path = file.path(out_dir, "metadata.csv").

extra_cols

Character vector of additional column names from obs to include, if present.

Value

Invisibly returns the metadata data frame.

Note

The common_name column reflects iNaturalist's preferred_common_name, which is typically in English but may vary depending on the taxon and iNaturalist's locale settings.

Examples

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

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