From df0e82ce3088df8450550399e343ca37d5893962 Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Fri, 1 Mar 2019 11:29:31 -0800 Subject: [PATCH] #214 attempting to return photos data in inat results --- DESCRIPTION | 2 +- R/inat.R | 10 +++++----- man-roxygen/occ_egs.R | 3 ++- man/occ.Rd | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 78bbdd6..cba7c6f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Description: A programmatic interface to many species occurrence data sources, System ('OBIS'), and Atlas of Living Australia ('ALA'). Includes functionality for retrieving species occurrence data, and combining those data. -Version: 0.9.0.9310 +Version: 0.9.0.9311 License: MIT + file LICENSE Authors@R: c(person(given = "Scott", diff --git a/R/inat.R b/R/inat.R index 5f3659f..8d3b9a6 100644 --- a/R/inat.R +++ b/R/inat.R @@ -1,7 +1,6 @@ spocc_inat_obs <- function(query=NULL, taxon = NULL, quality=NULL, geo=TRUE, - year=NULL, month=NULL, day=NULL, bounds=NULL, - date_start = NULL, date_end = NULL, - maxresults=100, page=NULL, callopts) { + year=NULL, month=NULL, day=NULL, bounds=NULL, date_start = NULL, + date_end = NULL, maxresults=100, page=NULL, callopts) { # input parameter checks if (!is.null(quality)) quality <- match.arg(quality, c("casual","research")) @@ -76,11 +75,12 @@ spocc_inat_obs <- function(query=NULL, taxon = NULL, quality=NULL, geo=TRUE, call. = FALSE) } + # photos_con <- list() page_query <- c(args, per_page = 200, page = 1) data <- cli$get(path = ping_path, query = page_query) data <- spocc_inat_handle(data) data_out <- jsonlite::fromJSON(data, flatten = TRUE) - data_out$photos <- NULL + # data_out$photos <- NULL data_out$tag_list <- sapply(data_out$tag_list, function(x) { if (length(x) == 0) "" else paste0(x, collapse = ", ") }) @@ -92,7 +92,7 @@ spocc_inat_obs <- function(query=NULL, taxon = NULL, quality=NULL, geo=TRUE, data <- cli$get(path = ping_path, query = page_query) data <- spocc_inat_handle(data) data_out2 <- jsonlite::fromJSON(data, flatten = TRUE) - data_out2$photos <- NULL + # data_out2$photos <- NULL data_out2$tag_list <- sapply(data_out2$tag_list, function(x) { if (length(x) == 0) "" else paste0(x, collapse = ", ") }) diff --git a/man-roxygen/occ_egs.R b/man-roxygen/occ_egs.R index 27bf93d..ef3d7f5 100644 --- a/man-roxygen/occ_egs.R +++ b/man-roxygen/occ_egs.R @@ -8,6 +8,8 @@ #' res$ebird #' (res <- occ(query = 'Danaus plexippus', from = 'inat', limit = 50)) #' res$inat +#' res$inat$data +#' data.table::rbindlist(res$inat$data$Danaus_plexippus$photos) #' (res <- occ(query = 'Bison bison', from = 'bison', limit = 50)) #' res$bison #' (res <- occ(query = 'Bison bison', from = 'vertnet', limit = 5)) @@ -21,7 +23,6 @@ #' one$gbif #' two$gbif #' -#' #' # Date range searches across data sources #' ## Not possible for ebird #' ## bison diff --git a/man/occ.Rd b/man/occ.Rd index a675c4d..f612a1d 100644 --- a/man/occ.Rd +++ b/man/occ.Rd @@ -362,6 +362,8 @@ res$ecoengine res$ebird (res <- occ(query = 'Danaus plexippus', from = 'inat', limit = 50)) res$inat +res$inat$data +data.table::rbindlist(res$inat$data$Danaus_plexippus$photos) (res <- occ(query = 'Bison bison', from = 'bison', limit = 50)) res$bison (res <- occ(query = 'Bison bison', from = 'vertnet', limit = 5)) @@ -375,7 +377,6 @@ two <- occ(query = 'Accipiter striatus', from = 'gbif', limit = 5, start = 5) one$gbif two$gbif - # Date range searches across data sources ## Not possible for ebird ## bison