| Title: | Download Photos and Metadata from 'iNaturalist' |
| Version: | 0.2.2 |
| Description: | A lightweight interface to the 'iNaturalist' API (https://www.inaturalist.org/pages/api+reference) for downloading observation photos and exporting metadata to CSV. Supports filtering by taxon, place, user, and annotation. Note that downloaded photos retain their original licenses as set by 'iNaturalist' observers; users are responsible for respecting these licenses. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.1.0) |
| Imports: | httr, jsonlite, dplyr, tidyr, purrr, rlang, stats, utils |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0), httptest2 |
| Config/testthat/edition: | 3 |
| URL: | https://github.com/andresarb/inatpick, https://andresarb.github.io/inatpick/ |
| BugReports: | https://github.com/andresarb/inatpick/issues |
| VignetteBuilder: | knitr |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-06-18 18:23:19 UTC; ar696 |
| Author: | Andrés Romero-Bravo [aut, cre] |
| Maintainer: | Andrés Romero-Bravo <aromerobravo@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-24 08:20:02 UTC |
inatpick: Download Photos and Metadata from iNaturalist
Description
A lightweight interface to the iNaturalist API for downloading observation photos and exporting metadata to CSV. Supports filtering by taxon, place, user, and annotation.
Details
The main workflow:
-
inat_search_taxon()/inat_search_place()— find taxon and place IDs -
inat_fetch()— retrieve observations from the API -
inat_download()— download photos to a local folder -
inat_metadata()— export observation metadata to CSV
Author(s)
Maintainer: Andrés Romero-Bravo aromerobravo@gmail.com
Authors:
Andrés Romero-Bravo aromerobravo@gmail.com
See Also
Useful links:
Report bugs at https://github.com/andresarb/inatpick/issues
iNaturalist annotation term and value IDs
Description
A named lookup table for human-readable annotation labels and their
corresponding iNaturalist term_id and term_value_id pairs, for use
with inat_fetch().
Usage
inat_annotations
Format
A data frame with columns label, term_id, term_value_id.
Value
A data frame with 20 rows and 3 columns (label, term_id,
term_value_id) listing all supported annotation labels and their
corresponding iNaturalist API term and term-value IDs.
Download photos from iNaturalist observations
Description
Downloads all photos from a data frame returned by inat_fetch(), and
optionally saves observation metadata to a CSV file in the same folder.
Usage
inat_download(
obs,
out_dir,
size = "large",
metadata = TRUE,
overwrite = FALSE,
verbose = TRUE
)
Arguments
obs |
Data frame returned by |
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 |
size |
Character. Photo size: |
metadata |
Logical. If |
overwrite |
Logical. Re-download files that already exist (default
|
verbose |
Logical. Print progress messages (default |
Value
Invisibly returns a data frame of photo URLs and local file paths.
Examples
## Not run:
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)
## End(Not run)
Fetch observations from the iNaturalist API
Description
Retrieves all observations matching the given filters, handling pagination automatically. Multiple annotations can be passed as a character vector; each is fetched separately and the results combined.
Usage
inat_fetch(
taxon_id,
place_id = NULL,
user_login = NULL,
annotation = NULL,
quality_grade = "any",
year = NULL,
month = NULL,
licensed = NULL,
per_page = 200,
verbose = TRUE
)
Arguments
taxon_id |
Integer. iNaturalist taxon ID (e.g. |
place_id |
Integer or |
user_login |
Character or |
annotation |
Character vector of annotation labels, or a single integer
vector |
quality_grade |
Character. One of |
year |
Integer or |
month |
Integer (1–12) or |
licensed |
Logical or |
per_page |
Integer. Results per API page (max 200). |
verbose |
Logical. Print progress messages (default |
Value
A data frame of observations with list-column photos.
See Also
inat_annotations for all annotation labels and IDs.
Examples
## Not run:
# Single annotation
obs <- inat_fetch(taxon_id = 488444, place_id = 6783,
annotation = "flowers")
# Multiple annotations
obs <- inat_fetch(taxon_id = 51935, place_id = 6857,
annotation = c("flowers", "green_leaves"))
# See all available annotation labels
inat_annotations
## End(Not run)
Export observation metadata to CSV
Description
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.
Usage
inat_metadata(obs, path, extra_cols = NULL)
Arguments
obs |
Data frame returned by |
path |
Character. Output CSV file path. There is no default: you
must specify a path, e.g. a file in your working directory or
|
extra_cols |
Character vector of additional column names from |
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
## Not run:
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"))
## End(Not run)
Search for a place by name on iNaturalist
Description
Returns matching places from iNaturalist, useful for finding the place ID
to pass to inat_fetch().
Usage
inat_search_place(name, n = 10)
Arguments
name |
Character. Place name to search. |
n |
Integer. Maximum number of results to return (default 10). |
Value
A data frame with columns id, name, display_name, and place_type.
Examples
## Not run:
inat_search_place("United Kingdom")
inat_search_place("Bolivia")
## End(Not run)
Search for a taxon by name on iNaturalist
Description
Returns matching taxa from iNaturalist, useful for finding the taxon ID
to pass to inat_fetch().
Usage
inat_search_taxon(name, rank = NULL, n = 10)
Arguments
name |
Character. Taxon name to search (common or scientific). |
rank |
Character or |
n |
Integer. Maximum number of results to return (default 10). |
Value
A data frame with columns id, name, common_name, rank, and
observations_count, ordered by number of observations.
Note
The common_name field reflects iNaturalist's preferred_common_name,
which is typically in English but may vary depending on the taxon and
iNaturalist's locale settings.
Examples
## Not run:
inat_search_taxon("Drosera rotundifolia")
inat_search_taxon("Drosera", rank = "genus")
inat_search_taxon("sundew", rank = "species")
## End(Not run)
Resolve annotation label to term_id and term_value_id
Description
Resolve annotation label to term_id and term_value_id
Usage
resolve_annotation(annotation)
Arguments
annotation |
Character. A label from inat_annotations, or an integer
vector of length 2 ( |
Value
A named integer vector with term_id and term_value_id.