Commit 04ae7e7b authored by Grelot Frederic's avatar Grelot Frederic :swimmer_tone5:
Browse files

Ajout de so_ii_crop_clc et des fonctionnalités associées

Showing with 95 additions and 13 deletions
+95 -13
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
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
......@@ -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
......
......@@ -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"]],
......
# 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)
File added
......@@ -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.}
......
% 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}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment