Created
February 20, 2026 21:04
-
-
Save szechno/6a9152798bfce2f413c61505903eb5ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(shinyWidgets) | |
| library(bslib) | |
| library(mapgl) | |
| library(sf) | |
| library(stringr) | |
| library(dplyr) | |
| library(DBI) | |
| library(RSQLite) | |
| library(callr) | |
| library(purrr) | |
| # library(glue) | |
| # library(reactlog) | |
| # library(bsicons) ## https://icons.getbootstrap.com | |
| library(rlang) | |
| # reactlog_enable() | |
| # inconsole:: options(shiny.reactlog = TRUE) | |
| # !! need to include attribution: <a href="https://www.flaticon.com/free-icons/adress" title="adress icons">Adress icons created by Boris farias - Flaticon</a> | |
| # West_Sussex_TSS_2025 | |
| # https://mackaszechno.shinyapps.io/West_Sussex_TSS_maplibre_2025/ | |
| # West_Sussex_TSS_maplibre_2025 | |
| # variables ---- | |
| ## geodata ---- | |
| geodata <- "./data/west sussex_tss_review_20250714a_esuid.gpkg" | |
| # IMPORTANT 2 RECORDS SET TO tss I AND C FOR TESTING... CHANGE BACK AS REQUIRED | |
| map_start <- c(-0.404549247616387, 50.9365654134795) | |
| initial_zoom <- 10 | |
| dft_color <- c("coral", "#DC143C", "darkred") | |
| cj_color <- c("#bc9958") | |
| bus_color <- c("#658e3b") | |
| train_color <- c("#6b717a", "#707f94") | |
| school_color <- c("#e2e218") | |
| emergency_color <- c("#5959f9") | |
| medical_color <- c("#78c5d3") | |
| retail_color <- c("#825e76") | |
| commerce_color <- c("#826a5e") | |
| leisure_color <- c("#bed378") | |
| grid_color <- c("#75b7a0") | |
| border_color <- c("#758cb7") | |
| NH_color <- c("pink") | |
| esusline_color <- c("#c997b8") | |
| lookup_class <- tibble( | |
| column = rep("CLASS", 7), | |
| classification = c("A", "B", "C", "D", "P", "Q", ""), | |
| colours = c("#22A884", "#2A788E", "#414487", "#440154", "#7AD151", "#f06060", "#ff02ff"), | |
| lwd = c( 5, 4, 3, 2, 1, 1, 1) | |
| ) | |
| lookup_tss <- tibble( | |
| column = rep("TSS", 5), | |
| classification = c("C", "D", "H", "I", ""), | |
| colours = c("#1f78b4", "#33a02c", "#e31a1c", "#ff7f00", "#f0f0f0"), | |
| lwd = rep(3, 5) | |
| ) | |
| # https://mastering-shiny.org/action-transfer.html#downloading-reports | |
| # https://www.datachamp.fr/en/posts/good-development-practices | |
| # to work on shinyapps.io | |
| ## report_path ---- | |
| report_path <- tempfile(fileext = ".Rmd") | |
| file.copy("./rmd/test__wscc_tss_review_v6a1_tss.Rmd", | |
| report_path, | |
| overwrite = TRUE) | |
| ## set colour squares for layer sidecard ---- | |
| dft_icons <- span(HTML("<div style=\"width: 10px; height: 10px; background-color: ", | |
| dft_color[1],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| dft_color[2],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| dft_color[3],";\"></div>")) | |
| cj_icons <- span(HTML("<div style=\"width: 10px; height: 10px; background-color: ", | |
| cj_color[1],";\"></div>")) | |
| transport_icons <- span(HTML("<div style=\"width: 10px; height: 10px; background-color: ", | |
| bus_color[1],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| train_color[1],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| train_color[2],";\"></div>")) | |
| school_icons <- span(HTML("<div style=\"width: 10px; height: 10px; background-color: ", | |
| school_color[1],";\"></div>")) | |
| emergency_icons <- span(HTML("<div style=\"width: 10px; height: 10px; background-color: ", | |
| emergency_color[1],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| medical_color[1],";\"></div>")) | |
| landuse_icons <- span(HTML("<div style=\"width: 10px; height: 10px; background-color: ", | |
| retail_color[1],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| commerce_color[1],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| leisure_color[1],";\"></div>")) | |
| boundary_icons <- span(HTML("<div style=\"width: 10px; height: 10px; background-color: ", | |
| grid_color[1],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| border_color[1],";\"></div>", | |
| "<div style=\"width: 10px; height: 10px; background-color: ", | |
| NH_color[1],";\"></div>")) | |
| esusline_icons <- span(HTML("<div style=\"width: 10px; height: 10px; background-color: ", | |
| esusline_color[1],";\"></div>")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment