# \donttest{
library(maps) #a convenient source of maps
library(sf)
species_vector <- c("Abies_lasiocarpa","Abies_amabilis")
#check whether the species are available
OpenRange_species(species_vector,match_names_only = TRUE)
#Create a temp directory
temp_dir <- file.path(tempdir(), "BIEN_temp")
#Download ranges
OpenRange_species(species = species_vector,
directory = temp_dir)#saves ranges to a temporary directory
#Reading files
Abies_poly <- st_read(dsn = temp_dir,
layer = "Abies_amabilis_117684")
#Plotting files
plot(Abies_poly[,1])#plots the range, but doesn't mean much without any reference
map('world', fill = TRUE, col = "grey")#plots a world map (WGS84 projection), in grey
plot(Abies_poly,col="forest green",add=TRUE) #adds the range of Abies lasiocarpa to the map
#Getting data from the files
Abies_poly |>
st_drop_geometry()
# }
Run the code above in your browser using DataLab