iobis / robis

R client for the OBIS API
https://iobis.github.io/robis
Other
37 stars 11 forks source link

How to obtain the latitude and longitude information of species? #107

Open luozhisen opened 11 months ago

luozhisen commented 11 months ago

I want to get the latitude and longitude of a species record in an area. How? I used areas for species and found none of this information

pieterprovoost commented 11 months ago

@luozhisen If you use the occurrence() function you will get georeferenced occurrence records. The coordinates are in columns decimalLongitude and decimalLatitude as decimal degrees. To apply a spatial filter either use the areaid or the geometry filter.

> library(robis)
> occ <- occurrence("Abra sibogai")
Retrieved 12 records of approximately 12 (100%)
> occ[,c("decimalLongitude", "decimalLatitude")]
# A tibble: 12 × 2
   decimalLongitude decimalLatitude
              <dbl>           <dbl>
 1             120.           14.0 
 2             120.           14.0 
 3             120.           14.0 
 4             120.           14   
 5             120.           13.8 
 6             120.           -6.31
 7             119.           -5.92
 8             120.           14   
 9             120.           -6.59
10             120.           13.9 
11             119.           -5.93
12             120.           13.7 

There are more examples in the vignette. If you are interested in gridded data then you can use the API directly as explained here.