An error occurred while loading the file. Please try again.
-
Delaigue Olivier authored024d41af
# code to prepare `so_ii_catchment` dataset goes here
file_dir = current_version(
"data-common/so-ii/topage",
pattern = "^[0-9-]+$"
)
so_ii_catchment = sf::st_read(file.path(file_dir, "bassin_versant_so_ii.shp"))
classification = read.csv(
current_version("data-common/so-ii/topage", pattern = "catchment"),
colClasses = "character"
)
# establishing levels of detail in catchments
so_ii_catchment[["degre"]] = 2
bassin_mosson = so_ii_catchment[so_ii_catchment[["id"]] %in% classification[["id"]][classification[["soussecteur"]] == "mosson"], ]
bassin_mosson_geom = sf::st_union(bassin_mosson)
bassin_mosson_df = data.frame(
id = "soii01",
bassin = "Bassin Mosson",
degre = 1
)
bassin_mosson = sf::st_set_geometry(bassin_mosson_df, bassin_mosson_geom)
bassin_lez = so_ii_catchment[so_ii_catchment[["id"]] %in% classification[["id"]][classification[["soussecteur"]] == "lez"], ]
bassin_lez_geom = sf::st_union(bassin_lez)
bassin_lez_df = data.frame(
id = "soii02",
bassin = "Bassin Lez",
degre = 1
)
bassin_lez = sf::st_set_geometry(bassin_lez_df, bassin_lez_geom)
bassin_lor = so_ii_catchment[so_ii_catchment[["id"]] %in% classification[["id"]][classification[["soussecteur"]] == "lor"], ]
bassin_lor_geom = sf::st_union(bassin_lor)
bassin_lor_df = data.frame(
id = "soii03",
bassin = "Bassin L'or",
degre = 1
)
bassin_lor = sf::st_set_geometry(bassin_lor_df, bassin_lor_geom)
so_ii_catchment = rbind(so_ii_catchment, bassin_mosson)
so_ii_catchment = rbind(so_ii_catchment, bassin_lez)
so_ii_catchment = rbind(so_ii_catchment, bassin_lor)
# updating datasets
# actual = setwd(file.path(system.file(package = "geau"), ".."))
actual = setwd("geau")
usethis::use_data(so_ii_catchment, internal = FALSE, overwrite = TRUE)
setwd(actual)