The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Package {inatpick}


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:

  1. inat_search_taxon() / inat_search_place() — find taxon and place IDs

  2. inat_fetch() — retrieve observations from the API

  3. inat_download() — download photos to a local folder

  4. inat_metadata() — export observation metadata to CSV

Author(s)

Maintainer: Andrés Romero-Bravo aromerobravo@gmail.com

Authors:

See Also

Useful links:


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 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

## 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. 488444 for Caiophora chuquitensis).

place_id

Integer or NULL. iNaturalist place ID (e.g. 6783 for Bolivia).

user_login

Character or NULL. iNaturalist username.

annotation

Character vector of annotation labels, or a single integer vector c(term_id, term_value_id), or NULL. Use labels from inat_annotations (e.g. "flowers", "green_leaves", "alive"). Multiple labels can be passed as c("flowers", "green_leaves") — each is fetched separately and results are combined. See inat_annotations for all valid labels.

quality_grade

Character. One of "research", "needs_id", or "any" (default).

year

Integer or NULL. Filter by observation year.

month

Integer (1–12) or NULL. Filter by observation month.

licensed

Logical or NULL. If TRUE, return only observations with a CC photo license.

per_page

Integer. Results per API page (max 200).

verbose

Logical. Print progress messages (default TRUE).

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 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

## 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 NULL. Filter results by taxonomic rank, e.g. "genus", "species", "family". Default NULL returns all ranks.

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 (c(term_id, term_value_id)) for direct ID use.

Value

A named integer vector with term_id and term_value_id.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.