Section 21 Measure Classification
## [1] "Chapter last run: 2024-11-15"
21.1 Introduction
Our measures are too loosely grouped, making it difficult for our optimization. We are aiming to have around 500 measures, currently we have more.
We will need our HRU ids spatially, as well as our Measures, erosion classes, and property register.
## [1] "sf 1.0.18"
## [1] "dplyr 1.1.4"
## [1] "DT 0.33"
Get our maps:
# For measure IDs and location:
lu_map <- read_sf("model_data/input/land/CS10_LU.shp")
# For HRU IDs:
hru_map <- read_sf("model_data/cs10_setup/optain-cs10/data/vector/hru.shp")
# For Erosion Risk Levels:
erosion_map <- read_sf("model_data/input/soil/erosionriskclasses_kraakstad.shp")
# For Farm ownership IDs:
farm_map <- read_sf("model_data/input/property/matrikkel.shp")
farm_map <- st_transform(farm_map, st_crs(lu_map))
Filter data
lu_filter <- lu_map %>% select("buffer_6m_", "gully", "wetland", "dam", "type", "geometry")
hru_filter <- hru_map %>% select("name", "type")
erosion_filter <- erosion_map %>% select("A_HPKL", "geometry")
farm_filter <- farm_map %>% select("GARDSNUMME", "geometry")
farm_dissolved <- farm_filter %>%
group_by(GARDSNUMME) %>%
summarise()
erosion_dissolved <- erosion_filter %>%
group_by(A_HPKL) %>%
summarise()
Map Farm ID
farm_dissolved$GARDSNUMME<-as.factor(farm_dissolved$GARDSNUMME)
farmcolors <- farm_dissolved$GARDSNUMME %>% unique() %>% length()
# samples randomizes legend
myfill <- hcl.colors(farmcolors, palette = "Dark 3") %>% sample()
mapview(farm_dissolved, zcol = "GARDSNUMME", legend = FALSE, col.regions = myfill)
Map Erosion Classes
myfill <- hcl.colors(4, palette = "Fall")
erosion_dissolved$A_HPKL <- as.factor(erosion_dissolved$A_HPKL)
mapview(erosion_dissolved, zcol = "A_HPKL", col.regions = myfill)
Ideally the above 4 maps would have their attributes spatially joined in R, but since I cannot figure out a nice way to do that, I did it quick and nicely in QGIS: