sciSpatialR: Spatial Harmonization and Covariate Extraction
Source:R/sciSpatialR-package.R
sciSpatialR-package.RdProvides tools for harmonizing spatial layers (masking, resampling, aggregating) and extracting covariates at point locations for Alberta-focused biodiversity and species distribution modelling workflows.
Reference Layers
Harmonization defaults to the Alberta provincial boundary and the
ABMI 1 km grid, both in NAD83 / Alberta 10-TM (Forest),
EPSG:3400. Every function below that takes a reference grid or
boundary falls back to these, so layers harmonized with this
package share one CRS, extent, resolution, and origin unless a
caller opts out.
ab_crs()— default CRS,"EPSG:3400"ab_boundary()— Alberta provincial boundary (2020 revision)ab_grid()— ABMI 1 km reference grid, 1234 x 695 cells
Input and Validation
check_alignment()— test CRS, extent, resolution, and origin congruence against a reference gridharmonize_crs()— transform points to raster CRS; warn if raster reprojection would be implied
Inspection
raster_stats()— per-layer cell counts, missingness, and value summariesplot_raster()— quick-look ggplot2 map with a quantile-stretched colour scale and boundary overlayplot_hist()— histogram of cell valuestheme_science_map()— the ggplot2 theme those maps use
Harmonization
mask_to_boundary()— mask to Alberta or a user-supplied polygonresample_to_grid()— align to a reference grid, choosing the resampling method from the resolution ratio and whether the layer is categorical
Extraction
extract_points()— point-in-cell raster extractionextract_vector()— point-in-polygon attribute joinextract_proportion()— class proportions within buffer for categorical layersextract_buffer()— summary statistic within one or more radii
Catalogue and Metadata
The catalogue is built by scanning the spatial data share and parsing the readme stored beside each dataset, so it is always a description of the data as it actually sits on disk. Readmes follow the ABMI spatial metadata template documented in the geospatial catalog and management guide at https://github.com/bgcasey/geospatial_catalog_and_management_guide.
spatial_root()— location of the data sharebuild_catalogue()— scan the share into a manifestlist_layers()— list catalogue contentslist_themes()— list ISO 19115 theme foldersfind_layer()— filter by theme, keyword, year, extent, resolution, CRSget_layer()— return a SpatRaster, SpatVector, or pathlayer_files()— list a layer's data fileslayer_meta()— source, vintage, licence, caveats, contactread_metadata()— parse one readmeas_metadata_row()— flatten metadata to a data.frame rowcheck_metadata()— audit metadata completeness
Author
Maintainer: Brendan Casey brendan.casey@ualberta.ca
Other contributors:
Alberta Biodiversity Monitoring Institute [copyright holder, funder]