Learn R Programming

paisaje (version 0.2.0)

get_records_by_hexagon: Retrieve species records aggregated by H3 hexagons

Description

Downloads species occurrence data within a specified Area of Interest (AOI) and aggregates these records into H3 hexagonal grid cells at a given resolution. Returns an `sf` object with one polygon per hexagon and columns containing species occurrence counts.

Usage

get_records_by_hexagon(
  species, aoi_sf, res = 6,
  providers = NULL, remove_duplicates = FALSE,
  date = NULL, expand_factor = 0.1, limit = 500
)

Value

sf object. H3 hex grid with species occurrence counts.

Arguments

species

character vector. Species names to query.

aoi_sf

sf object. Area of Interest polygon.

res

integer. H3 resolution level (1–16). Default: 6.

providers

character vector. Data providers to query. Default: NULL (all).

remove_duplicates

logical. Remove duplicate records. Default: FALSE.

date

character vector of length two. Start and end dates for filtering records.

expand_factor

numeric. Expand AOI bounding box. Default: 0.1.

limit

integer. Maximum number of occurrence records per species. Default: 500.

Details

This function is useful for spatial biodiversity analyses where data should be aggregated into a uniform spatial grid. The H3 grid system enables multi-resolution analysis and efficient spatial summarization of point occurrence data.

Examples

Run this code
# \donttest{
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
)
print(hex_counts)
# }

Run the code above in your browser using DataLab