-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.Rmd
60 lines (43 loc) · 1.83 KB
/
map.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: "Interactive map"
output:
distill::distill_article:
toc: true
toc_depth: 3
---
```{r setup, include=FALSE}
source("readdata.R", local = knitr::knit_global())
```
<font size = 2>
```{r echo=FALSE, layout="l-page"}
filter_slider("Year", "Select year interval", sd, ~Year)
bscols(
filter_select("Pub1", "Select article(s)", sd, ~Pub1),
filter_select("Host", "Host", sd, ~Host),
filter_select("FGSC", "Species", sd, ~FGSC),
filter_select("TRI_genotype", "Select genotype(s)", sd, ~TRI_genotype)
)
```
</font>
```{r echo=FALSE, layout="l-page", fig.height=5}
library(RColorBrewer)
library(htmltools)
pal <- colorFactor("RdYlBu", domain = c("15-ADON", "3-ADON", "DON", "NIV", "DON/NIV", "NX-2", "NA"))
leaflet(data = sd) %>%
setView(-0, 15, zoom = 2) %>%
addTiles() %>%
addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
addProviderTiles("OpenTopoMap", group = "Terrain") %>%
addScaleBar("bottomright") %>%
addProviderTiles(providers$CartoDB.Voyager, group = "Default") %>%
addLayersControl(
baseGroups = c("Default", "Aerial", "Terrain"),
overlayGroups = "FGSC",
options = layersControlOptions(collapsed = TRUE)
) %>%
addCircleMarkers(group = "TRI_genotype", radius = 3, fillOpacity = 0.8, weight=0.5, color = NA, fillColor = ~pal(TRI_genotype), label = paste(fgsc$FGSC,"- click for details"), popup = paste("Collection code:<b>", fgsc$`Collection code`, "</b>", "<br><i>", fgsc$FGSC,"</i>(", fgsc$TRI_genotype, ")<br>", "Host:", fgsc$Host,"<br>","Location:", fgsc$Country, "<br>","Year of collection:", fgsc$Year, "<br>","Reference:", fgsc$Pub1))%>%
addLegend("bottomleft", pal = pal, values = ~TRI_genotype, title = "TRI genotype", opacity = 1 )%>%
addEasyButton(easyButton(
icon="fa-globe", title="Back to initial view",
onClick=JS("function(btn, map){ map.setZoom(2); }")))
```