|
@@ -3,6 +3,7 @@ library(shiny)
|
3
|
3
|
library(leaflet)
|
4
|
4
|
library(dplyr)
|
5
|
5
|
library(shinyWidgets)
|
|
6
|
+library(htmltools)
|
6
|
7
|
|
7
|
8
|
leafcols <- c("blue", "red", "darkred", "lightred",
|
8
|
9
|
"orange", "beige", "green", "darkgreen",
|
|
@@ -16,7 +17,8 @@ Geo2017$Snargle <- c(TRUE, rep(FALSE, 5))
|
16
|
17
|
DHBs <- sort(unique(Geo2017$dhb_name))
|
17
|
18
|
DHBs <- c(DHBs[DHBs != "Missing"], "Missing")
|
18
|
19
|
|
19
|
|
-dhbcols <- leafcols[1:length(DHBs)]
|
|
20
|
+# dhbcols <- leafcols[1:length(DHBs)]
|
|
21
|
+dhbcols <- rainbow(length(DHBs))
|
20
|
22
|
names(dhbcols) <- DHBs
|
21
|
23
|
dhbcol <- function(DHB) {
|
22
|
24
|
sdf <- dhbcols[DHB]
|
|
@@ -89,21 +91,39 @@ server <- function(input, output) {
|
89
|
91
|
if (input$selcol == "Snargleflagen") {
|
90
|
92
|
gl <- addCircleMarkers(gl, lng = Geo2017$lon,
|
91
|
93
|
lat = Geo2017$lat,
|
92
|
|
- popup = Geo2017$name,
|
|
94
|
+ popup = sprintf("<strong>%s</strong><br/>%s<br/>DHB: %s<br/>%s",
|
|
95
|
+ htmlEscape(Geo2017$name),
|
|
96
|
+ htmlEscape(Geo2017$address),
|
|
97
|
+ htmlEscape(Geo2017$dhb_name),
|
|
98
|
+ ifelse(Geo2017$Snargle,
|
|
99
|
+ "Snargleflagen",
|
|
100
|
+ "Non-snargleflagen")),
|
93
|
101
|
# color = snargcols[as.character(Geo2017$dhb_name)]
|
94
|
102
|
col = snargcol(Geo2017$Snargle)
|
95
|
103
|
)
|
96
|
104
|
} else if (input$selcol == "DHB") {
|
97
|
105
|
gl <- addCircleMarkers(gl, lng = Geo2017$lon,
|
98
|
106
|
lat = Geo2017$lat,
|
99
|
|
- popup = Geo2017$name,
|
|
107
|
+ popup = sprintf("<strong>%s</strong><br/>%s<br/>DHB: %s<br/>%s",
|
|
108
|
+ htmlEscape(Geo2017$name),
|
|
109
|
+ htmlEscape(Geo2017$address),
|
|
110
|
+ htmlEscape(Geo2017$dhb_name),
|
|
111
|
+ ifelse(Geo2017$Snargle,
|
|
112
|
+ "Snargleflagen",
|
|
113
|
+ "Non-snargleflagen")),
|
100
|
114
|
# color = dhbcols[Geo2017$dhb_name]
|
101
|
115
|
col = dhbcol(Geo2017$dhb_name)
|
102
|
116
|
)
|
103
|
117
|
} else {
|
104
|
118
|
gl <- addCircleMarkers(gl, lng = Geo2017$lon,
|
105
|
119
|
lat = Geo2017$lat,
|
106
|
|
- popup = Geo2017$name,
|
|
120
|
+ popup = sprintf("<strong>%s</strong><br/>%s<br/>DHB: %s<br/>%s",
|
|
121
|
+ htmlEscape(Geo2017$name),
|
|
122
|
+ htmlEscape(Geo2017$address),
|
|
123
|
+ htmlEscape(Geo2017$dhb_name),
|
|
124
|
+ ifelse(Geo2017$Snargle,
|
|
125
|
+ "Snargleflagen",
|
|
126
|
+ "Non-snargleflagen")),
|
107
|
127
|
col= "blue")
|
108
|
128
|
}
|
109
|
129
|
gl
|