ropensci / spocc

Species occurrence data toolkit for R
https://docs.ropensci.org/spocc
Other
115 stars 27 forks source link

Search with occ does not match the inatopts #250

Closed ManuelSpinola closed 2 years ago

ManuelSpinola commented 2 years ago

When searching with occ for only mammals for a specific year the search return all the records besides mammals.

library(spocc)
library(rnaturalearth)
library(rnaturalearthhires)

```{r}
cr <- ne_countries(continent = "north america", scale = 10, returnclass = "sf") |>
  dplyr::filter(iso_a3 == "CRI")
limites <- st_bbox(cr)
mam <- occ(from = "inat", geometry = limites, inatopts = list(taxon_name = "Mammalia", year = 2015, maxresults = 10000))
hannahlowens commented 2 years ago

Hi, Thanks for the clear, reproducible code accompanying your question. The issue, as I understand it, is that spocc is not set up to query iNaturalist using anything other than the species name. That is, giving it a class name isn't compatible with the way spocc interacts with the iNaturalist API, so instead you're getting all the records from iNaturalist that fit you parameters. This includes mammals--the second result in the table is Tapirus bairdii. I have three suggestions--1. You can iterate through a list of all the species you are looking for if you want to use iNaturalist via spocc, 2. You can use spocc to search for "Mammalia" in GBIF, then filter the results for iNaturalist occurrences, or 3. You can search for "Mammalia" using the rinat package. I'd suggest the former two solutions, depending on your preferences if you want data from multiple sources (that is, maybe iNat and GBIF and BISON) and the latter if iNaturalist is the only source you want and you don't have or want to produce a list of all species within Mammalia.

Here is a blog post that walks you through these options a bit: https://www.r-bloggers.com/2014/03/accessing-inaturalist-data/

I hope that helps.

ManuelSpinola commented 2 years ago

Thank you very much Hannah, very helpful.

Manuel

El lun, 30 may 2022 a las 13:06, Hannah Owens @.***>) escribió:

Hi, Thanks for the clear, reproducible code accompanying your question. The issue, as I understand it, is that spocc is not set up to query iNaturalist using anything other than the species name. That is, giving it a class name isn't compatible with the way spocc interacts with the iNaturalist API, so instead you're getting all the records from iNaturalist that fit you parameters. This includes mammals--the second result in the table is Tapirus bairdii. I have three suggestions--1. You can iterate through a list of all the species you are looking for if you want to use iNaturalist via spocc, 2. You can use spocc to search for "Mammalia" in GBIF, then filter the results for iNaturalist occurrences, or 3. You can search for "Mammalia" using the rinat package. I'd suggest the former two solutions, depending on your preferences if you want data from multiple sources (that is, maybe iNat and GBIF and BISON) and the latter if iNaturalist is the only source you want and you don't have or want to produce a list of all species within Mammalia.

Here is a blog post that walks you through these options a bit: https://www.r-bloggers.com/2014/03/accessing-inaturalist-data/

I hope that helps.

— Reply to this email directly, view it on GitHub https://github.com/ropensci/spocc/issues/250#issuecomment-1141420663, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFI3FB2U2ZAQS2ODHNFM6V3VMUGUDANCNFSM5XJDKKKA . You are receiving this because you authored the thread.Message ID: @.***>

-- Manuel Spínola, Ph.D. Instituto Internacional en Conservación y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA @. @.> @.*** Teléfono: (506) 8706 - 4662 Institutional website: ICOMVIS http://www.icomvis.una.ac.cr/index.php/manuel Blog sobre Ciencia de Datos: https://mspinola-ciencia-de-datos.netlify.app