diff --git a/geau/DESCRIPTION b/geau/DESCRIPTION index f98b01a78c96790b010b571b5d427905dba436c7..9c88698d843412671cf7925dbf443b19b37ff5d6 100644 --- a/geau/DESCRIPTION +++ b/geau/DESCRIPTION @@ -1,6 +1,6 @@ Package: geau Title: Utilities very useful to share within geau-inondation team -Version: 1.0.10.0 +Version: 1.0.11.0 Authors@R: c( person(given = "Frédéric", diff --git a/geau/R/map_so_ii.r b/geau/R/map_so_ii.r index 2976c9acdfc5ea80209156a1b4151ed437f7ca85..9f022e421a2a6b7df31ef268cb6af317b34ec133 100644 --- a/geau/R/map_so_ii.r +++ b/geau/R/map_so_ii.r @@ -64,7 +64,7 @@ map_so_ii = function( dataset, dataset_legend = NULL, - theme = c("none", "collectivity", "catchment", "catnat", "clc", "hydro", "onrn", "population"), + theme = c("none", "collectivity", "catchment", "catnat", "clc", "hydro", "onrn", "osm", "population"), theme_legend = FALSE, detail, year, @@ -97,6 +97,7 @@ map_so_ii = function( "collectivity" = map_theme_collectivity(detail, theme_legend), "hydro" = map_theme_hydro(detail, theme_legend), "onrn" = map_theme_onrn(detail, theme_legend), + "osm" = map_theme_osm(), "population" = map_theme_population(detail, year, theme_legend), NULL ) @@ -523,6 +524,17 @@ map_theme_onrn = function(detail, add_legend) { } } +map_theme_osm = function() { + so_ii_osm = terra::rast( + system.file("extdata", "so_ii_osm.tif", package = "geau", mustWork = TRUE) + ) + terra::plot(so_ii_osm, add = TRUE) + graphics::mtext( + text = "Fond de carte : \u00a9 Contributeurs OpenStreetMap", + side = 1, line = -1, adj = 1, cex = .6, font = 3 + ) +} + map_theme_population = function(detail, year, add_legend) { if (missing(year)) { year = utils::tail(sort(colnames(geau::so_ii_population)), 1) diff --git a/geau/data-raw/so_ii_osm.R b/geau/data-raw/so_ii_osm.R new file mode 100644 index 0000000000000000000000000000000000000000..f61a55c78d523a02deff4d8baccce2cd50919e4d --- /dev/null +++ b/geau/data-raw/so_ii_osm.R @@ -0,0 +1,11 @@ +# code to prepare `so_ii_osm` dataset goes here +library(sf) +library(maptiles) + +so_ii_osm = maptiles::get_tiles(geau::so_ii_limit, zoom = 10, crop = TRUE) + +# updating datasets + +actual = setwd("geau") +terra::writeRaster(so_ii_osm, "inst/extdata/so_ii_osm.tif", overwrite = TRUE) +setwd(actual) diff --git a/geau/inst/extdata/so_ii_osm.tif b/geau/inst/extdata/so_ii_osm.tif new file mode 100644 index 0000000000000000000000000000000000000000..5db3ff661158aa454207497c711031511ed38ccc Binary files /dev/null and b/geau/inst/extdata/so_ii_osm.tif differ diff --git a/geau/inst/extdata/so_ii_osm.tif.aux.xml b/geau/inst/extdata/so_ii_osm.tif.aux.xml new file mode 100644 index 0000000000000000000000000000000000000000..fc27fcd04a288e028d24faf046b98e7f548165ad --- /dev/null +++ b/geau/inst/extdata/so_ii_osm.tif.aux.xml @@ -0,0 +1,29 @@ +<PAMDataset> + <PAMRasterBand band="1"> + <Description>red</Description> + <Metadata> + <MDI key="STATISTICS_MAXIMUM">253</MDI> + <MDI key="STATISTICS_MEAN">-9999</MDI> + <MDI key="STATISTICS_MINIMUM">37</MDI> + <MDI key="STATISTICS_STDDEV">-9999</MDI> + </Metadata> + </PAMRasterBand> + <PAMRasterBand band="2"> + <Description>green</Description> + <Metadata> + <MDI key="STATISTICS_MAXIMUM">250</MDI> + <MDI key="STATISTICS_MEAN">-9999</MDI> + <MDI key="STATISTICS_MINIMUM">37</MDI> + <MDI key="STATISTICS_STDDEV">-9999</MDI> + </Metadata> + </PAMRasterBand> + <PAMRasterBand band="3"> + <Description>blue</Description> + <Metadata> + <MDI key="STATISTICS_MAXIMUM">246</MDI> + <MDI key="STATISTICS_MEAN">-9999</MDI> + <MDI key="STATISTICS_MINIMUM">37</MDI> + <MDI key="STATISTICS_STDDEV">-9999</MDI> + </Metadata> + </PAMRasterBand> +</PAMDataset> diff --git a/geau/man/map_so_ii.Rd b/geau/man/map_so_ii.Rd index ba06effad63d9fd1826c960f6483d1d9dda78902..71b7535907045ac78fbdeac8ac41f673684910cf 100644 --- a/geau/man/map_so_ii.Rd +++ b/geau/man/map_so_ii.Rd @@ -9,7 +9,7 @@ map_so_ii( dataset, dataset_legend = NULL, theme = c("none", "collectivity", "catchment", "catnat", "clc", "hydro", "onrn", - "population"), + "osm", "population"), theme_legend = FALSE, detail, year,