Add habitat information to spatial features
add_habitats.RdThis function calculates habitat areas and related statistics for given spatial features
Details
The function performs the following steps:
Validates the input sf object and checks for the presence of the specified id column.
Loads the CORINE Land Cover 2018 data for Belgium (CLC18_BE) from the fistools package.
Calculates the area of each feature in square meters, hectares, and square kilometers.
Computes the intersection between the input features and the CLC18_BE habitat data.
Calculates the area of each habitat type within each feature.
Computes additional statistics for forest habitats (bos), including density, average area, and perimeter.
Merges the habitat information back to the original sf_data and calculates habitat percentages.
Ensures that the total habitat area does not differ from the total area by more than 1%.
Returns a data frame with habitat areas and statistics for each feature.