rspatial / geodata

download geographic data
GNU General Public License v3.0
151 stars 15 forks source link

`sp_occurrence` obscure error when species not in GBIF #36

Closed AMBarbosa closed 1 year ago

AMBarbosa commented 1 year ago

If we misspell a taxon name, sp_occurrence adequately returns 0 when download=FALSE, i.e. zero records on GBIF for the specified taxon. But if download=TRUE (the default), a puzzling error message appears:

sp_occurrence(genus = "Pathera", species = "leo", download = FALSE)
# [1] 0

sp_occurrence(genus = "Pathera", species = "leo")
# Error in sp_occurrence(genus = "Pathera", species = "leo") : 
  start <= end is not TRUE

Could it instead emit a message indicating what the problem is? Cheers!

rhijmans commented 1 year ago

Thanks, I now get:

s = sp_occurrence(genus = "Pathera", species = "leo")
#no records found
s
#NULL