Skip to content

Commit

Permalink
Allowing sf bounds to be used.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Jung committed Aug 3, 2019
1 parent b02841b commit c591d0d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/get_inat_obs.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ get_inat_obs <- function(query = NULL, taxon_name = NULL, taxon_id = NULL,
}

if(!is.null(bounds)){
if(inherits(bounds,"sf")){
bounds_prep <- as.vector(sf::st_bbox(bounds))
bounds <- c(swlat = bounds_prep[2], swlng = bounds_prep[1], nelat = bounds_prep[4], nelng = bounds_prep[3] );rm(bounds_prep)
}
if(length(bounds) != 4){stop("Bounding box specifications must have 4 coordinates.")}
search <- paste0(search, "&swlat=", bounds[1], "&swlng=", bounds[2],
"&nelat=", bounds[3], "&nelng=", bounds[4])
Expand Down

0 comments on commit c591d0d

Please sign in to comment.