diff --git a/dev/tag-message b/dev/tag-message new file mode 100644 index 0000000000000000000000000000000000000000..6cd1ee2ba703e6e542e90f5c5ba801e9ac9c5ba8 --- /dev/null +++ b/dev/tag-message @@ -0,0 +1,22 @@ +so.ii Version: 1.0.20.0 + +0 errors ✔ | 0 warnings ✔ | 0 notes ✔ + +**Note de version** + * ajout de so_ii_clc_crop + * ajout des sous-options "crop" & "poth" pour le theme "clc" de map_so_ii + +**Détails** + * so_ii_clc_crop est une version croppée de CLC sur une bouding box autour + de so_ii_limit qui permet de donner des informations autour de ce périmètre. + La mer a été ajoutée. + * map_so_ii permet la possibilité de choisir l'affichage pour le theme + "clc" via l'option "detail" : + - "so.ii" (valeur par défaut) donne le même résultat que précédemment, + seul les informations à l'intérieur de so_ii_limit sont affichées + - "crop" donne les informations dans le bounding box entier + - "borth" donnes les informations dans le bouding box en mettant en + exergue celles à l'intérieur du périmètre. + +# git tag -a v1.0.20.0 -F dev/tag-message +# git push --tags diff --git a/so.ii/DESCRIPTION b/so.ii/DESCRIPTION index 1e73d016fee507857e1ae8f9b81a59a4ca91f679..ff87870bc2a948da1cf84fe942bf3f2357d94a63 100644 --- a/so.ii/DESCRIPTION +++ b/so.ii/DESCRIPTION @@ -1,6 +1,6 @@ Package: so.ii Title: Utilities very useful to share within so_ii team -Version: 1.0.19.0 +Version: 1.0.20.0 Authors@R: c( person(given = "Frédéric", @@ -32,5 +32,5 @@ Suggests: rmarkdown, testthat Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.2 VignetteBuilder: knitr diff --git a/so.ii/R/data.r b/so.ii/R/data.r index 3bbbb7d6c5577698e97e0fc7c4ed47eb161100f9..43d4b7306930de3dc878e5c28a65fd1f21a0a7a2 100644 --- a/so.ii/R/data.r +++ b/so.ii/R/data.r @@ -51,6 +51,18 @@ #' } "so_ii_clc" +#' CLC information for a crop zone around so-ii +#' +#' A dataset containing the Corine Land Cover information on so-ii. A row is +#' added to CLC to plot also the sea. It has code "000". +#' +#' @format sf data.frame 1337 rows, 2 variables +#' \describe{ +#' \item{clc_2018}{character, classification from CLC 2018} +#' \item{color}{character, default color to be used to plot so_ii_clc} +#' } +"so_ii_clc_crop" + #' Spatial definition of collectivities included in so-ii #' #' A dataset containing the spatial definition of all collectivities diff --git a/so.ii/R/map_so_ii.r b/so.ii/R/map_so_ii.r index 4986f752efc10517299957f77cb3eabce17e3e36..f0b28e1e7da4d8e74e6028e4ed37950c52d73027 100644 --- a/so.ii/R/map_so_ii.r +++ b/so.ii/R/map_so_ii.r @@ -33,6 +33,9 @@ #' \item{\strong{catnat}: detail must be chosen in "inondation", #' "submersion", or "nappe". If missing all type will be chosen and #' aggregated before plotting.} +#' \item{\strong{clc}: detail must be chosen in "so.ii", "crop", +#' "both". If missing, "so.ii" will be chosen, and only information inside +#' so_ii_limit is plotted.} #' \item{\strong{collectivity}: detail must be chosen in "none", "syble", #' "symbo", "epci" or "syndicate". If missing, "none" will be chosen, #' and only the boundaries of collectivities are plotted.} @@ -152,7 +155,7 @@ map_so_ii = function( EXPR = theme, "catchment" = map_theme_catchment(detail, theme_legend), "catnat" = map_theme_catnat(detail, year, theme_legend), - "clc" = map_theme_clc(theme_legend), + "clc" = map_theme_clc(detail, theme_legend), "collectivity" = map_theme_collectivity(detail, theme_legend), "hydro" = map_theme_hydro(detail, theme_legend), "onrn" = map_theme_onrn(detail, theme_legend), @@ -337,14 +340,33 @@ map_theme_catnat = function(detail, year, add_legend) { } } -map_theme_clc = function(add_legend) { - plot( - so.ii::so_ii_clc[["geometry"]], - border = NA, - col = so.ii::so_ii_clc[["color"]], - add = TRUE +map_theme_clc = function(detail, add_legend) { + if (missing(detail)) { + detail = "so.ii" + } + detail = match.arg( + detail, + c("so.ii", "crop", "both") ) + if (detail %in% c("crop", "both")) { + plot( + so.ii::so_ii_clc_crop[["geometry"]], + border = NA, + col = so.ii::so_ii_clc_crop[["color"]], + add = TRUE + ) + } + + if (detail %in% c("so.ii", "both")) { + plot( + so.ii::so_ii_clc[["geometry"]], + border = NA, + col = so.ii::so_ii_clc[["color"]], + add = TRUE + ) + } + theme_legend = list( title = "CLC (2018)", legend = so.ii::clc_color[["label_fr"]], diff --git a/so.ii/data-raw/so_ii_clc.R b/so.ii/data-raw/so_ii_clc.R index 09fbc34a328105933dacd4c0eed987c8fa2d53b7..1263b923173c5e0830de57e2296cfbb38a13c195 100644 --- a/so.ii/data-raw/so_ii_clc.R +++ b/so.ii/data-raw/so_ii_clc.R @@ -1,7 +1,8 @@ # code to prepare `so_ii_clc` dataset goes here library(sf) -so_ii_clc = readRDS("data-common/data/so-ii/so-ii_clc.rds") -so_ii_clc = so_ii_clc["clc_2018"] +so_ii_clc = readRDS("data-common/so-ii/clc/so-ii_clc.rds") +so_ii_clc = readRDS("data-common/so-ii/clc/so-ii_clc.rds") +so_ii_clc_crop = readRDS("data-common/so-ii/clc/so-ii_clc-crop.rds") clc_color = data.frame( color = scales::alpha( @@ -41,5 +42,6 @@ so_ii_clc[["color"]] = as.character( actual = setwd("so.ii") usethis::use_data(so_ii_clc, internal = FALSE, overwrite = TRUE) +usethis::use_data(so_ii_clc_crop, internal = FALSE, overwrite = TRUE) usethis::use_data(clc_color, internal = FALSE, overwrite = TRUE) setwd(actual) diff --git a/so.ii/data/so_ii_clc_crop.rda b/so.ii/data/so_ii_clc_crop.rda new file mode 100644 index 0000000000000000000000000000000000000000..9e85d6c5448626f57ce56c2aa38623b4eba769d5 Binary files /dev/null and b/so.ii/data/so_ii_clc_crop.rda differ diff --git a/so.ii/man/map_so_ii.Rd b/so.ii/man/map_so_ii.Rd index d0136443f2eace7b9be045ea361991d18ea46cbc..383fd5ff843741b08200bc734b8aad281890b214 100644 --- a/so.ii/man/map_so_ii.Rd +++ b/so.ii/man/map_so_ii.Rd @@ -8,8 +8,8 @@ map_so_ii( dataset, dataset_legend = NULL, - theme = c("none", "collectivity", "catchment", "catnat", "clc", "hydro", "onrn", - "osm", "population"), + theme = c("none", "collectivity", "catchment", "catnat", "clc", "hydro", "onrn", "osm", + "population"), theme_legend = FALSE, detail, year, @@ -80,6 +80,9 @@ for levels of detail. If missing, "1" will be chosen.} \item{\strong{catnat}: detail must be chosen in "inondation", "submersion", or "nappe". If missing all type will be chosen and aggregated before plotting.} +\item{\strong{clc}: detail must be chosen in "so.ii", "crop", +"both". If missing, "so.ii" will be chosen, and only information inside +so_ii_limit is plotted.} \item{\strong{collectivity}: detail must be chosen in "none", "syble", "symbo", "epci" or "syndicate". If missing, "none" will be chosen, and only the boundaries of collectivities are plotted.} diff --git a/so.ii/man/so_ii_clc_crop.Rd b/so.ii/man/so_ii_clc_crop.Rd new file mode 100644 index 0000000000000000000000000000000000000000..2db0c12edd39b83941a04c8e88bbe1c4813f0a32 --- /dev/null +++ b/so.ii/man/so_ii_clc_crop.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.r +\docType{data} +\name{so_ii_clc_crop} +\alias{so_ii_clc_crop} +\title{CLC information for a crop zone around so-ii} +\format{ +sf data.frame 1337 rows, 2 variables +\describe{ +\item{clc_2018}{character, classification from CLC 2018} +\item{color}{character, default color to be used to plot so_ii_clc} +} +} +\usage{ +so_ii_clc_crop +} +\description{ +A dataset containing the Corine Land Cover information on so-ii. A row is +added to CLC to plot also the sea. It has code "000". +} +\keyword{datasets}