1.1. Shapefile
Let’s assume we are interested in having a floristic knowledge of the
western part of the Mediterranean basin. For this purpose, we can simply
use a shape file of the region of interest and feed it to the
GIFT_checklists()
function.
We do provide a shape file of this region in the GIFT
R
package, which you can access using the
data("western_mediterranean")
command.
data("western_mediterranean")
world <- ne_coastline(scale = "medium", returnclass = "sf")
world_countries <- ne_countries(scale = "medium", returnclass = "sf")
# Fixing polygons crossing dateline
world <- st_wrap_dateline(world)
world_countries <- st_wrap_dateline(world_countries)
# Eckert IV projection
eckertIV <-
"+proj=eck4 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
ggplot(world) +
geom_sf(color = "gray50") +
geom_sf(data = western_mediterranean, fill = "darkblue", color = "black",
alpha = 0.5, size = 1) +
labs(title = "Western Mediterranean basin") +
lims(x = c(-20, 20), y = c(24, 48)) +
theme_void()

Please note that shapes used in GIFT are unprojected
(Geographic Coordinate System WGS84), and that all shapefiles
provided should be in this CRS. You can check the coordinate
reference system of a sf object by using sf::st_crs().
1.2. Main arguments
Now that we have a shape for the region of interest, let’s call
GIFT_checklists()
. This wrapper function has many arguments
which we detail in this subsection.
First, the taxonomic group of
interest. We can be interested in a particular group of plants, for
example only Angiosperms. In that case, we would set the
taxon_name
argument like this
taxon_name = "Angiospermae"
. If we are interested in a
particular plant family, let’s say orchids, then
taxon_name = "Orchidaceae"
.
To see all options for the
taxon_name
argument, you can run the
GIFT_taxonomy()
function and look at the
taxon_name
column of its output.
Together with this
first argument comes complete_taxon
. This argument, set by
default to TRUE defines whether only regions represented by checklists
in GIFT completely covering the taxon of interest
should be retrieved. Figure 1 is explaining the principle.
In Figure 1, we want to retrieve checklists of Angiosperms. In
the first region available, region A only one checklist is of interest.
This checklist is then always retrieved. In region B, there is only a
checklist of orchids, which is a subset only of Angiosperms. If
complete_taxon
is set to TRUE
, then this
checklist won’t be retrieved, otherwise yes. Finally, in region C, there
is a checklist of vascular plants and one for orchids. In both cases,
the checklist of vascular plants will be retrieved after filtering out
the non-angiosperm species. The species of Orchids is also retrieved in
both cases as it is not the only one available and as it can complete
the floristic knowledge for Angiosperms in this region.
Following arguments of GIFT_checklists()
relate to the
floristic statuses of plant species. We can for example only be
interested in endemic species, or naturalized species. Default value is
retrieving all native species.
Similarly, two arguments are needed
in the function. First, floristic_group
defines the group
of interest. Second, complete_floristic
states whether
incomplete regions regarding the floristic group chosen should be
retrieved or not. The logic is detailed in Figure 2 and is similar to
the complete_taxon
argument shown before.
The next set of arguments relate to spatial matching between the
desired area and the GIFT database.
The main argument in that regard, when providing a shapefile or a set
of coordinates, is the overlap
argument. This argument can
get 4 options, each of these options leading to a different outcome as
explained in Figure 3.
On Figure3, the GIFT polygons represented in orange either intersect,
fall inside or outside the provided shape file. The overlap argument
below each GIFT polygon illustrates in which situation a given GIFT
polygon is retrieved or not.
Another important spatial feature we provide is the possibility to
remove overlapping polygons. Indeed, for many regions in the world,
there are several polygons in GIFT database that cover them. If
overlapping polygons are not an issue for your case study, you can
simply set remove_overlap
to FALSE (top right part of
Figure 4). But in case you want one polygon only per region, then
remove_overlap
can be set to TRUE
. In that
case, the GIFT_checklists()
will either retrieve the
smaller or the larger polygon. This will depend on the values set for
the argument area_threshold_mainland
as detailed in Figure
4.
area_threshold_mainland
takes a value in \(km^2\). In case the area of the smaller
polygon is below the threshold, then the larger overlapping polygon will
be retrieved (bottom left part in Figure 4). If the smaller polygon
exceeds that threshold, then it will be retrieved (bottom right part of
Figure 4). There is a similar argument for islands,
area_threshold_island
, which is by default set to 0 \(km^2\). That way, by default, the smaller
islands are always retrieved.
Please also note that polygons
are considered as overlapping when the exceed a certain percentage of
overlap. This percentage can be modified using the
overlap_threshold
argument (Figure 5). This argument is set
by default to 10%.
1.3. GIFT_checklists()
Now that we covered the main arguments of
GIFT_checklists()
, we can retrieve plant checklists for the
Mediterranean region. GIFT_checklists()
returns a list of
two elements. First the metadata of checklists fulfilling the different
criteria, named $lists
. The second element is a
data.frame
of all the checklists with the species
composition per checklist ($checklists
).
If you only
want to retrieve the metadata, you can set the argument
list_set_only
to TRUE
.
ex_meta <- GIFT_checklists(taxon_name = "Angiospermae",
shp = western_mediterranean,
overlap = "centroid_inside",
list_set_only = TRUE)
And to retrieve the species composition:
medit <- GIFT_checklists(taxon_name = "Angiospermae",
complete_taxon = TRUE,
floristic_group = "native",
complete_floristic = TRUE,
geo_type = "All",
shp = western_mediterranean,
overlap = "centroid_inside",
remove_overlap = FALSE,
taxonomic_group = TRUE) # this argument adds two
# columns to the checklist: plant family and taxonomic group of each species
We can now have an estimation on the number of checklists with native
Angiosperm species in the western part of the Mediterranean basin, as
well as of the number of species.
# Number of references covered
length(unique(medit[[2]]$ref_ID))
# 22 references
# Number of checklists covered (one reference can have several lists inside)
length(unique(medit[[2]]$list_ID))
# 115 checklists
# Number of species
length(unique(medit[[2]]$work_species))
# 12840 plant species
You can now apply different values for the arguments detailed
above. When being stricter with some criteria, you can see that the
number of checklists retrieved decreases. For example, when removing
overlapping regions:
medit_no_overlap <- GIFT_checklists(shp = western_mediterranean,
overlap = "centroid_inside",
taxon_name = "Angiospermae",
remove_overlap = TRUE)
# Number of references covered
length(unique(medit[[2]]$ref_ID)) # 23 references
length(unique(medit_no_overlap[[2]]$ref_ID)) # 22 references
Please note that the function not only works with a shape file but
can accept a set of coordinates. The example below illustrates a case in
which you want to retrieve GIFT checklists intersecting the coordinates
of Göttingen.
custom_point <- cbind(9.9, 51) # coordinates of Göttingen
got <- GIFT_checklists(coordinates = custom_point,
overlap = "extent_intersect",
taxon_name = "Angiospermae",
remove_overlap = TRUE,
list_set_only = TRUE)
To cite properly the references retrieved, you can run the function
GIFT_references()
and look for the column
ref_long``. The column also
geo_entity_ref` associates each
reference to a name.
1.4. Species richness map
Once we downloaded a set of checklists, it is possible to map the
species richness of the taxonomic group of interest. For this purpose,
we use a combination of two functions: GIFT_richness()
which either retrieves species richness or trait coverage per polygon
and GIFT_shapes()
which retrieves the shapefile of a list
of GIFT polygons.
The next two chunks illustrate this for the
Angiosperms in the World and in the Western part of the Mediterranean
basin.
gift_shapes <- GIFT_shapes() # retrieves all shapefiles by default
angio_rich <- GIFT_richness(taxon_name = "Angiospermae")
rich_map <- dplyr::left_join(gift_shapes, angio_rich, by = "entity_ID") %>%
dplyr::filter(stats::complete.cases(total))
ggplot(world) +
geom_sf(color = "gray50") +
geom_sf(data = rich_map, aes(fill = total + 1)) +
scale_fill_viridis_c("Species number\n(log-transformed)", trans = "log10",
labels = scales::number_format(accuracy = 1)) +
labs(title = "Angiosperms", subtitle = "Projection EckertIV") +
coord_sf(crs = eckertIV) +
theme_void()

By customizing the code above, you can also produce a nicer
map:

Below is the R
code to produce the above map if
interested.
Fancier code
# Background box
xmin <- st_bbox(world)[["xmin"]]; xmax <- st_bbox(world)[["xmax"]]
ymin <- st_bbox(world)[["ymin"]]; ymax <- st_bbox(world)[["ymax"]]
bb <- sf::st_union(sf::st_make_grid(st_bbox(c(xmin = xmin,
xmax = xmax,
ymax = ymax,
ymin = ymin),
crs = st_crs(4326)),
n = 100))
# Equator line
equator <- st_linestring(matrix(c(-180, 0, 180, 0), ncol = 2, byrow = TRUE))
equator <- st_sfc(equator, crs = st_crs(world))
ggplot(world) +
geom_sf(data = bb, fill = "aliceblue") +
geom_sf(data = equator, color = "gray50", linetype = "dashed",
linewidth = 0.1) +
geom_sf(data = world_countries, fill = "antiquewhite1", color = NA) +
geom_sf(color = "gray50", linewidth = 0.1) +
geom_sf(data = bb, fill = NA) +
geom_sf(data = rich_map,
aes(fill = ifelse(rich_map$entity_class %in%
c("Island/Mainland", "Mainland",
"Island Group", "Island Part"),
total + 1, NA)),
size = 0.1) +
geom_point(data = rich_map,
aes(color = ifelse(rich_map$entity_class %in%
c("Island"),
total + 1, NA),
geometry = geometry),
stat = "sf_coordinates", size = 1, stroke = 0.5) +
scale_color_gradientn(
"Species number", trans = "log10", limits = c(1, 40000),
colours = RColorBrewer::brewer.pal(5, name = "Greens"),
breaks = c(1, 10, 100, 1000, 10000, 40000),
labels = c(1, 10, 100, 1000, 10000, 40000),
na.value = "transparent") +
scale_fill_gradientn(
"Species number", trans = "log10", limits = c(1, 40000),
colours = RColorBrewer::brewer.pal(5, name = "Greens"),
breaks = c(1, 10, 100, 1000, 10000, 40000),
labels = c(1, 10, 100, 1000, 10000, 40000),
na.value = "transparent") +
labs(title = "Angiosperms", subtitle = "Projection EckertIV") +
coord_sf(crs = eckertIV) +
theme_void()
We can also produce maps of richness at intermediate scales. Here is
the code and the map of Angiosperms in the Western Mediterranean
basin.
med_shape <- gift_shapes[which(gift_shapes$entity_ID %in%
unique(medit[[2]]$entity_ID)), ]
med_rich <- angio_rich[which(angio_rich$entity_ID %in%
unique(medit[[2]]$entity_ID)), ]
med_map <- dplyr::left_join(med_shape, med_rich, by = "entity_ID") %>%
dplyr::filter(stats::complete.cases(total))
ggplot(world) +
geom_sf(color = "gray50") +
geom_sf(data = western_mediterranean,
fill = "darkblue", color = "black", alpha = 0.1, size = 1) +
geom_sf(data = med_map, aes(fill = total)) +
scale_fill_viridis_c("Species number") +
labs(title = "Angiosperms in the Western Mediterranean basin") +
lims(x = c(-20, 20), y = c(24, 48)) +
theme_void()
