Get species records by hexagon
get_records_by_hexagon.Rd
Retrieves species occurrence data within a given AOI and aggregates the records into H3 hexagonal grid cells. Counts the number of occurrences per species within each hexagon. Returns an `sf` object.
Usage
get_records_by_hexagon(species, aoi_sf, res = 6,
providers = NULL, remove_duplicates = FALSE, date = NULL,
expand_factor = 0.1, limit = 500)
Arguments
- species
Character vector of species names.
- aoi_sf
`sf` polygon of the AOI.
- res
H3 resolution (1–16). Default 6.
- providers
Character vector of data providers (e.g., "gbif").
- remove_duplicates
Logical. Remove duplicate geometries. Default FALSE.
- date
Character vector c("start","end") to filter by date.
- expand_factor
Numeric. Expand AOI bbox for full hex coverage. Default 0.1.
- limit
Integer. Maximum number of records to download per species. Default 500.
Examples
if (FALSE) { # \dontrun{
library(sf)
nc <- sf::st_read(system.file("shape/nc.shp", package="sf"))
hex_counts <- get_records_by_hexagon(
species = c("Lynx rufus"),
aoi_sf = nc,
res = 6,
limit = 200
)
} # }