diff --git a/DESCRIPTION b/DESCRIPTION index a74c79b..f64a937 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -50,7 +50,6 @@ Imports: pkgload (>= 1.2.2), promises, purrr (>= 0.3.4), - rmapshaper (>= 0.4.5), RPostgres (>= 1.3.3), sf (>= 1.0.2), shinipsum (>= 0.1.0), diff --git a/R/utils_helpers.R b/R/utils_helpers.R index 20df703..39d0aa9 100644 --- a/R/utils_helpers.R +++ b/R/utils_helpers.R @@ -224,8 +224,8 @@ generate_datasets <- function(con) { query = "SELECT * FROM diadesatlas.v_ices_geom;" ) %>% # sf::st_transform("+proj=eqearth +wktext") %>% - sf::st_transform("+proj=wintri") %>% - rmapshaper::ms_simplify() + sf::st_transform("+proj=wintri") # %>% + # rmapshaper::ms_simplify() species_order <- c( "Alosa alosa", diff --git a/data-raw/db_to_json.R b/data-raw/db_to_json.R deleted file mode 100644 index b3ee95a..0000000 --- a/data-raw/db_to_json.R +++ /dev/null @@ -1,57 +0,0 @@ -## code to prepare `db_to_json` dataset goes here - -library(DBI) -library(dplyr) -library(dbplyr) -con <- DBI::dbConnect( - RPostgres::Postgres(), - host = "postgis", - dbname = "diades", - port = 5432, - user = askpass::askpass("Please enter the user"), - password = askpass::askpass("Please enter the password") -) - -# List of case studies -casestudy <- tbl(con, in_schema("diadesatlas", "casestudy")) %>% collect() -# List of the corresponding basins -casestudy_basin <- tbl(con, in_schema("diadesatlas", "casestudy_basin")) %>% collect() -# Put them two together -cstd <- full_join(casestudy, casestudy_basin) -# We now have casestudy_id + casestudy_name + basin_id -cstd - -# We'll use the basin_outlet, simplified geom, to draw on the map -qry <- "SELECT ST_Transform(diadesatlas.basin_outlet.simplified_geom, 4326) as geom, basin_id as basin_id FROM diadesatlas.basin_outlet" - -# Query it as an sf object, -pols <- sf::st_read(con, query = qry, geom = "geom") %>% - # keep only the basin which are in the case study, - filter(basin_id %in% casestudy_basin$basin_id) %>% - # Then add the info from cstd - left_join(cstd) %>% - filter(publishable) - -# Save it as a geojson, so that we can reuse it on the leaflet map -pols %>% - geojson::as.geojson() %>% - geojson::geo_write("inst/casestudy.json") - -# List of ecosystem services -ecosystems <- tbl(con, in_schema("diadesatlas", "ecosystem_service")) %>% collect() -# we'll only keep the lines where the species is present -ecosystems %>% - filter(presence == 1, casestudy_id %in% casestudy$casestudy_id) %>% - jsonlite::write_json("inst/ecosystems.json") - -# Services -# Getting the services as is -services <- tbl(con, in_schema("diadesatlas", "cices")) %>% collect() -services %>% - jsonlite::write_json("inst/services.json") - -# Species -species <- tbl(con, in_schema("diadesatlas", "species")) %>% collect() -species %>% - filter(species_id %in% ecosystems$species_id) %>% - jsonlite::write_json("inst/species.json") \ No newline at end of file diff --git a/renv.lock b/renv.lock index 987f6fa..b096f62 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.2.0", + "Version": "4.2.3", "Repositories": [ { "Name": "RSPM", @@ -77,14 +77,14 @@ "Package": "R6", "Version": "2.5.1", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "470851b6d5d0ac559e9d01bb352b4021" }, "RColorBrewer": { "Package": "RColorBrewer", "Version": "1.1-2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "e031418365a7f7a766181ab5a41a5716" }, "RPostgres": { @@ -119,7 +119,7 @@ "Package": "abind", "Version": "1.4-5", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "4f57884290cc75ab22f4af9e9d4ca862" }, "askpass": { @@ -199,7 +199,7 @@ "Package": "bookdown", "Version": "0.26", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "65ebdc552e88fc98c596f4797c5415ad" }, "brew": { @@ -304,7 +304,7 @@ "Package": "cpp11", "Version": "0.4.2", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "fa53ce256cd280f468c080a58ea5ba8c" }, "crayon": { @@ -328,18 +328,11 @@ "Repository": "RSPM", "Hash": "2b06f9e415a62b6762e4b8098d2aecbc" }, - "crul": { - "Package": "crul", - "Version": "1.1.0", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "345d571cc120a54c91ac952c6da4392e" - }, "curl": { "Package": "curl", "Version": "4.3.2", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "022c42d49c28e95d69ca60446dbabf88" }, "data.table": { @@ -353,7 +346,7 @@ "Package": "dbplyr", "Version": "2.1.1", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "1f37fa4ab2f5f7eded42f78b9a887182" }, "desc": { @@ -451,7 +444,7 @@ "Package": "evaluate", "Version": "0.14", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "ec8ca05cffcc70569eaaad8469d2a3a7" }, "fansi": { @@ -465,7 +458,7 @@ "Package": "farver", "Version": "2.1.0", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "c98eb5133d9cb9e1622b8691487f11bb" }, "fastmap": { @@ -486,7 +479,7 @@ "Package": "fontawesome", "Version": "0.2.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "55624ed409e46c5f358b2c060be87f67" }, "foreign": { @@ -517,27 +510,6 @@ "Repository": "RSPM", "Hash": "4d243a9c10b00589889fe32314ffd902" }, - "geojson": { - "Package": "geojson", - "Version": "0.3.4", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "8d2107f1ebe9a75339e9fd130c07c1f6" - }, - "geojsonio": { - "Package": "geojsonio", - "Version": "0.9.4", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "dd28191bf66c323c60d2c5352a0ca3ad" - }, - "geojsonlint": { - "Package": "geojsonlint", - "Version": "0.4.0", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "60c515ce70b7db3a86e94ad9eed3ea8a" - }, "geojsonsf": { "Package": "geojsonsf", "Version": "2.0.1", @@ -584,7 +556,7 @@ "Package": "globals", "Version": "0.15.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "ace993e2dad5e64ed46391302b79e94f" }, "glue": { @@ -605,7 +577,7 @@ "Package": "gridExtra", "Version": "2.3", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "7d7f283939f563670a697165b2cf5560" }, "gtable": { @@ -619,7 +591,7 @@ "Package": "here", "Version": "1.0.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "24b224366f9c2e7534d2344d10d59211" }, "highr": { @@ -647,16 +619,9 @@ "Package": "htmlwidgets", "Version": "1.5.4", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "76147821cd3fcd8c4b04e1ef0498e7fb" }, - "httpcode": { - "Package": "httpcode", - "Version": "0.3.0", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "13641a1c6d2cc98801b76764078e17ea" - }, "httpuv": { "Package": "httpuv", "Version": "1.6.3", @@ -668,7 +633,7 @@ "Package": "httr", "Version": "1.4.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "a525aba14184fec243f9eaec62fbed43" }, "igraph": { @@ -696,16 +661,9 @@ "Package": "isoband", "Version": "0.2.5", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "7ab57a6de7f48a8dc84910d1eca42883" }, - "jqr": { - "Package": "jqr", - "Version": "1.2.1", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "b8a2e63d67833aa65c6592cfc0fa8f65" - }, "jquerylib": { "Package": "jquerylib", "Version": "0.1.4", @@ -727,13 +685,6 @@ "Repository": "RSPM", "Hash": "98138e0994d41508c7a6b84a0600cfcb" }, - "jsonvalidate": { - "Package": "jsonvalidate", - "Version": "1.1.0", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "81054bf17db72db68871baefcfd209cf" - }, "knitr": { "Package": "knitr", "Version": "1.36", @@ -745,14 +696,14 @@ "Package": "labeling", "Version": "0.4.2", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "3d5108641f47470611a32d0bdf357a72" }, "later": { "Package": "later", "Version": "1.3.0", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "7e7b457d7766bc47f2a5f21cc2984f8e" }, "lattice": { @@ -808,7 +759,7 @@ "Package": "listenv", "Version": "0.8.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "0bde42ee282efb18c7c4e63822f5b4f7" }, "lubridate": { @@ -906,7 +857,7 @@ "Package": "parallelly", "Version": "1.32.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "022489ebce2ef2438db4583fae118240" }, "patchwork": { @@ -997,16 +948,9 @@ "Package": "promises", "Version": "1.2.0.1", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "4ab2c43adb4d4699cf3690acd378d75d" }, - "protolite": { - "Package": "protolite", - "Version": "2.1", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "c05e98fd430da3ec9255cd15b617469a" - }, "proxy": { "Package": "proxy", "Version": "0.4-26", @@ -1098,13 +1042,6 @@ "Repository": "RSPM", "Hash": "093584b944440c5cd07a696b3c8e0e4c" }, - "rgeos": { - "Package": "rgeos", - "Version": "0.5-5", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "94a44c3f0d49ceb80c385610696873ca" - }, "rlang": { "Package": "rlang", "Version": "0.4.11", @@ -1112,13 +1049,6 @@ "Repository": "RSPM", "Hash": "515f341d3affe0de9e4a7f762efb0456" }, - "rmapshaper": { - "Package": "rmapshaper", - "Version": "0.4.5", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "e9b5ef157705c60c0fdb683570c082dd" - }, "rmarkdown": { "Package": "rmarkdown", "Version": "2.14", @@ -1143,7 +1073,7 @@ "Package": "rprojroot", "Version": "2.0.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "249d8cd1e74a8f6a26194a91b47f21d1" }, "rstudioapi": { @@ -1192,7 +1122,7 @@ "Package": "scales", "Version": "1.1.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "6f76f71042411426ec8df6c54f34e6dd" }, "sessioninfo": { @@ -1227,7 +1157,7 @@ "Package": "shiny", "Version": "1.7.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "00344c227c7bd0ab5d78052c5d736c44" }, "shinythemes": { @@ -1241,7 +1171,7 @@ "Package": "sourcetools", "Version": "0.1.7", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "947e4e02a79effa5d512473e10f41797" }, "sp": { @@ -1349,13 +1279,6 @@ "Repository": "RSPM", "Hash": "dfcb77371df343b663d6668d2d63ac35" }, - "triebeard": { - "Package": "triebeard", - "Version": "0.3.0", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "847a9d113b78baca4a9a8639609ea228" - }, "units": { "Package": "units", "Version": "0.7-2", @@ -1363,13 +1286,6 @@ "Repository": "RSPM", "Hash": "e0f85712d5371ab2841f63cdb33fe0f0" }, - "urltools": { - "Package": "urltools", - "Version": "1.7.3", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "e86a704261a105f4703f653e05defa3e" - }, "usethis": { "Package": "usethis", "Version": "2.0.1", @@ -1381,7 +1297,7 @@ "Package": "utf8", "Version": "1.2.2", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "c9c462b759a5cc844ae25b5942654d13" }, "vctrs": { @@ -1402,7 +1318,7 @@ "Package": "viridisLite", "Version": "0.4.0", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "55e157e2aa88161bdb0754218470d204" }, "visNetwork": { @@ -1470,7 +1386,7 @@ "Package": "xfun", "Version": "0.31", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Hash": "a318c6f752b8dcfe9fb74d897418ab2b" }, "xml2": { @@ -1491,7 +1407,7 @@ "Package": "xtable", "Version": "1.8-4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Hash": "b8acdf8af494d9ec19ccb2481a9b11c2" }, "xts": {