From 1484251b82322a228f67508c47bbdbad9bca92d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20C=C3=A1mara?= Date: Wed, 28 Jul 2021 13:46:00 +0100 Subject: [PATCH] Task #18 - Adds more data types to map (WIP) --- tulcea/tulcea_dashboard.Rmd | 21 ++++++++---- tulcea/tulcea_dashboard.html | 63 ++++++++++++++++++++++++++---------- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/tulcea/tulcea_dashboard.Rmd b/tulcea/tulcea_dashboard.Rmd index 71062d3..0e84fda 100644 --- a/tulcea/tulcea_dashboard.Rmd +++ b/tulcea/tulcea_dashboard.Rmd @@ -25,7 +25,14 @@ library(tidyverse) library(wfenexus) # Load data -salepoints_df <- read_csv("data/salepoints.csv") +salepoints_df <- read_csv("data/salepoints.csv") %>% + mutate(data_type = "Sale Points") + +producers_df <- read.csv("data/producers.csv") %>% + mutate(data_type = "Producers") + +combined_df <- salepoints_df %>% + full_join(producers_df) # Colours @@ -72,7 +79,7 @@ Interactive Map {data-icon="ion-map"} ===================================== ```{r} -sd <- SharedData$new(salepoints_df) +sd <- SharedData$new(combined_df) ``` @@ -84,10 +91,10 @@ Column {data-width=400} ```{r filters} filter_select( - id = "type", - label = "Type", + id = "sel_data_type", + label = "Type of Point", sharedData = sd, - group = ~type + group = ~data_type ) bscols( @@ -181,7 +188,7 @@ Column {.tabset .tabset-fade data-width=600} ### Interactive map ```{r} -groups <- c("Sale points") +groups <- c("Sale Points") map <- leaflet(sd) %>% addProviderTiles("CartoDB.Positron", group = "Positron (default)", @@ -200,7 +207,7 @@ map <- leaflet(sd) %>% # Adds controls addLayersControl( baseGroups = c("Positron (default)", "OSM", "Toner", "Toner Lite"), - overlayGroups = c("Sale Points", "Outline"), + overlayGroups = groups, options = layersControlOptions(collapsed = TRUE) ) %>% leaflet::addMeasure() diff --git a/tulcea/tulcea_dashboard.html b/tulcea/tulcea_dashboard.html index bb6427a..bbae64c 100644 --- a/tulcea/tulcea_dashboard.html +++ b/tulcea/tulcea_dashboard.html @@ -2750,19 +2750,20 @@

Filters

-
- +
+
-
@@ -2778,12 +2779,33 @@

Filters

AGROFOOD
+
+ +
+
+ +
+
+ +
@@ -2793,6 +2815,12 @@

Filters

+
+
+ @@ -2806,10 +2834,11 @@

Filters

@@ -2821,8 +2850,8 @@

Datatable

-
- +
+
@@ -2832,8 +2861,8 @@

Interactive map

-
- +
+

Plot

@@ -2846,8 +2875,8 @@

Overview

-
- +
+

About