I want to assemble some species occurrence data from inat and GBIF for New Zealand using SPOCC.
I’d like to do that using a bounding box to cover NZ and offshore islands.
The obvious bounding box has the usual issue of failing because it crosses the 180/-180 meridian.
The solution, I assumed, was to provide two adjacent bounding boxes on either side of the meridian.
Here’s an example without too much data …
Thanks for your question. I’ll look closely in the morning, but at first glance I think we may not allow for multiple bounding boxes passed in at once. …
This shouldn’t work, providing two boxes. In the current version this errors for me with Error: length(bbox) == 4 is not TRUE. Maybe we should support multiple bounding boxes For now, you could just pass those in a for loop or lapply type call.
Looking at the actual search results now, not sure why that’s not working…
Ah, there must be some interaction when you give geometry as a list and when you also give a taxon name to query. I think i’ve identified the line of code that’s causing the problem https://github.com/ropensci/spocc/blob/master/R/occ.r#L80 - looks like when a taxon name and geometry as a character or numeric vector we’re fine, but if it’s a list, then it blows up.
still need to do some fixing to the print method for this, as there are gbif results, but they aren’t shown in the print method…coming soon https://github.com/ropensci/spocc/issues/143 - UPDATE: fixed the print methods i believe
Note that the way occ() behaves when you pass in more than one thing to the geometry is that we do a separate request to the data provider for each geometry element (i.e., bounding box or WKT string). None of the data providers allow multiple geometry elements in one call, so this is what we’re left with. Internally, we do a separate request for each geometry element, and combine those results for each taxon name queried. Of course if you don’t query for any taxa, then each result is just for that geometry bounding box/WKT string