Create Spatial Unit for PRA (Petite Région Agricole)
create_spatial_unit.pra.RdThis function reads a raw shapefile containing PRA commune data, aggregates geometries by PRA code, and optionally writes the resulting spatial units to a shapefile.
Usage
create_spatial_unit.pra(
write_results = cfg$data$write_results,
cfg = loadConfig()
)Arguments
- write_results
logical If
TRUEwrites the results in the data folder. See returned value ofloadConfig.- cfg
a config object. Configuration to use. See loadConfig for details
Value
An sf object containing PRA spatial units with aggregated geometries grouped by PRA_Code. Records with missing PRA_Code values are filtered out.
Details
The function performs the following steps:
Reads the raw shapefile "CommunePra_SFWGS84_WithCell.shp" from the configured raw data directory
Groups geometries by PRA_Code
Unions overlapping geometries within each PRA group
Removes records where PRA_Code is NA
Optionally writes the result to "spatial_unit_pra.shp" in the configured GIS output directory