## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse  = TRUE,
  comment   = "#>",
  eval      = FALSE
)

## -----------------------------------------------------------------------------
# library(inatpick)

## -----------------------------------------------------------------------------
# # Search for the genus Drosera
# inat_search_taxon("Drosera", rank = "genus")
# # → id = 51935
# 
# # Search for the place
# inat_search_place("United Kingdom")
# # → id = 6857

## -----------------------------------------------------------------------------
# obs <- inat_fetch(
#   taxon_id      = 51935,        # Drosera genus
#   place_id      = 6857,         # United Kingdom
#   user_login    = "andresrb",
#   annotation    = c("green_leaves", "flowers"),
#   quality_grade = "research",
#   licensed      = TRUE
# )
# 
# nrow(obs)  # how many unique observations?

## -----------------------------------------------------------------------------
# inat_download(
#   obs,
#   out_dir = "drosera_uk",
#   size    = "large"
# )

## -----------------------------------------------------------------------------
# inat_download(obs, out_dir = "drosera_uk", metadata = FALSE)

## -----------------------------------------------------------------------------
# inat_metadata(obs, path = "drosera_uk.csv")

## -----------------------------------------------------------------------------
# # See all available annotation labels and their IDs
# inat_annotations

## -----------------------------------------------------------------------------
# # Research-grade only, flowering, in July
# obs_july <- inat_fetch(
#   taxon_id      = 51935,
#   place_id      = 6857,
#   annotation    = "flowers",
#   quality_grade = "research",
#   month         = 7
# )
# 
# # All observations worldwide — use with caution for common taxa
# obs_world <- inat_fetch(taxon_id = 51935)

