Is it possible to download inaturalist images with spocc / rinat ?

Hello everyone! I’m trying to download observations from iNaturalist, and I would like to get the actual photo of the organism as well as the rest of the metadata for each observation. I’ve gone over the documentation and the functions in both spocc and rinat but nothing jumped out at me. Is it possible?

1 Like

good question. I don’t know rinat that well, but for spocc we have been just dropping the photos array before returing data because we were focused primarily on the occurrence data of name, lat, lon, etc…

If you can give it a whirl, i’ve commented out that line of code in a branch, let me know what you think.

remotes::install_github("ropensci/spocc@sidecar")
library(spocc)
res <- occ(query = 'Danaus plexippus', from = 'inat', limit = 50)
res$inat
res$inat$data
data.table::rbindlist(res$inat$data$Danaus_plexippus$photos) # or other data.frame binding 
2 Likes

hello @sckott, and thank you so much for your answer! I’ve tried the branch that you created, and unfortunately I didn’t get photos, or links to photos in the response. I did get the observation_photos_count variable, as well as the URI for every observation. We’re considering scraping as a possible solution.
would this discussion be better as a feature request on the spocc repo?

bummer, just tried the code block from scratch and it worked for me.

Yes, an issue would be good.

it works beautifully now after updating to dplyr 0.8!! Thank you again @sckott

1 Like

Glad it works. Yeah, i am on dplyr greater than v0.8, wasn’t expecting that to be a problem :thinking:

1 Like