Skip to contents

Get the distribution of taxa on a 10 x 10 km UTM grid. Point coordinates represent the center of each grid cell, not actual plant locations.

Usage

get_distribution(genus = NULL, species = NULL, subspecies = NULL, sf = TRUE)

Arguments

genus

character. One or more genera to check for presence. Required, unless gbif.id is provided.

species

character. Optional. One or more species names to check for presence. The length of genus must equal that of species, unless length(genus) == 1, in which case it will be assumed that all species belong to that same genus.

subspecies

character. Optional. One or more subspecies names to check for presence. The length of species must equal that of subspecies, unless length(species) == 1, in which case it will be assumed that all subspecies belong to that same species.

sf

Logical. Return a spatial (sf) or a plain dataframe?

Value

An sf object if sf = TRUE, a plain dataframe otherwise.

Examples

abies <- get_distribution("Abies")
abies
#> Simple feature collection with 242 features and 4 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -5.522 ymin: 36.438 xmax: 3.061 ymax: 43.206
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>    Genus Species Subspecies UTM.cell              geometry
#> 1  Abies    alba       <NA>  30TXM89 POINT (-0.753 42.385)
#> 2  Abies    alba       <NA>  30TXM99 POINT (-0.631 42.383)
#> 3  Abies    alba       <NA>  30TXN27 POINT (-1.463 43.117)
#> 4  Abies    alba       <NA>  30TXN32 POINT (-1.353 42.666)
#> 5  Abies    alba       <NA>  30TXN33  POINT (-1.35 42.756)
#> 6  Abies    alba       <NA>  30TXN34 POINT (-1.348 42.846)
#> 7  Abies    alba       <NA>  30TXN35 POINT (-1.345 42.936)
#> 8  Abies    alba       <NA>  30TXN36 POINT (-1.343 43.026)
#> 9  Abies    alba       <NA>  30TXN38 POINT (-1.338 43.206)
#> 10 Abies    alba       <NA>  30TXN44 POINT (-1.226 42.844)
unique(abies$Species)  # including all species in the genus
#> [1] "alba"    "pinsapo"

pinsapo <- get_distribution("Abies", "pinsapo")
pinsapo
#> Simple feature collection with 30 features and 4 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -5.522 ymin: 36.438 xmax: -4.401 ymax: 36.991
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>     Genus Species Subspecies UTM.cell              geometry
#> 213 Abies pinsapo       <NA>  30STF76 POINT (-5.519 36.704)
#> 214 Abies pinsapo       <NA>  30STF77 POINT (-5.522 36.794)
#> 215 Abies pinsapo       <NA>  30STF85 POINT (-5.404 36.616)
#> 216 Abies pinsapo       <NA>  30STF86 POINT (-5.407 36.706)
#> 217 Abies pinsapo       <NA>  30STF87  POINT (-5.41 36.796)
#> 218 Abies pinsapo       <NA>  30STF88 POINT (-5.413 36.887)
#> 219 Abies pinsapo       <NA>  30STF93 POINT (-5.287 36.438)
#> 220 Abies pinsapo       <NA>  30STF95 POINT (-5.292 36.619)
#> 221 Abies pinsapo       <NA>  30STF97 POINT (-5.298 36.799)
#> 222 Abies pinsapo       <NA>  30STF99 POINT (-5.303 36.979)