|
@@ -7,7 +7,7 @@ library(shinyWidgets)
|
7
|
7
|
library(htmltools)
|
8
|
8
|
|
9
|
9
|
pinbase <- "https://doc.petras.space/public/pin-icon-"
|
10
|
|
-pins <- c("black", "blue", "red", "aqua", "green", "purple")
|
|
10
|
+pins <- c("black", "blue", "red", "pink", "green", "purple")
|
11
|
11
|
pinsuf <- ".svg"
|
12
|
12
|
pinurl <- function(col) {
|
13
|
13
|
sprintf("%s%s%s", pinbase, col, pinsuf)
|
|
@@ -23,18 +23,18 @@ dhbcar <- c(
|
23
|
23
|
"Auckland District Health Board" = "green",
|
24
|
24
|
"Bay of Plenty District Health Board" = "blue",
|
25
|
25
|
"Canterbury District Health Board" = "blue",
|
26
|
|
- "Capital and Coast District Health Board" = "aqua",
|
27
|
|
- "Counties Manukau District Health Board" = "aqua",
|
28
|
|
- "Hawkes Bay District Health Board" = "aqua",
|
|
26
|
+ "Capital and Coast District Health Board" = "pink",
|
|
27
|
+ "Counties Manukau District Health Board" = "pink",
|
|
28
|
+ "Hawkes Bay District Health Board" = "pink",
|
29
|
29
|
"Hutt Valley District Health Board" = "green",
|
30
|
30
|
"Lakes District Health Board" = "red",
|
31
|
31
|
"Mid Central District Health Board" = "blue",
|
32
|
32
|
"Nelson Marlborough District Health Board" = "purple",
|
33
|
33
|
"Northland District Health Board" = "blue",
|
34
|
34
|
"South Canterbury District Health Board" = "green",
|
35
|
|
- "Southern District Health Board" = "aqua",
|
|
35
|
+ "Southern District Health Board" = "pink",
|
36
|
36
|
"Tairawhiti District Health Board" = "green",
|
37
|
|
- "Taranaki District Health Board" = "aqua",
|
|
37
|
+ "Taranaki District Health Board" = "pink",
|
38
|
38
|
"Waikato District Health Board" = "purple",
|
39
|
39
|
"Wairarapa District Health Board" = "red",
|
40
|
40
|
"Waitemata District Health Board" = "red",
|
|
@@ -53,6 +53,21 @@ snargcol <- function(snarg) {
|
53
|
53
|
ifelse(snarg, "red", "blue")
|
54
|
54
|
}
|
55
|
55
|
|
|
56
|
+piconlist <- iconList(
|
|
57
|
+ black = makeIcon(pinurl("black"), iconWidth = 30,
|
|
58
|
+ iconHeight = 30, iconAnchorX = 15, iconAnchorY = 30),
|
|
59
|
+ blue = makeIcon(pinurl("blue"), iconWidth = 30,
|
|
60
|
+ iconHeight = 30, iconAnchorX = 15, iconAnchorY = 30),
|
|
61
|
+ red = makeIcon(pinurl("red"), iconWidth = 30,
|
|
62
|
+ iconHeight = 30, iconAnchorX = 15, iconAnchorY = 30),
|
|
63
|
+ pink = makeIcon(pinurl("pink"), iconWidth = 30,
|
|
64
|
+ iconHeight = 30, iconAnchorX = 15, iconAnchorY = 30),
|
|
65
|
+ green = makeIcon(pinurl("green"), iconWidth = 30,
|
|
66
|
+ iconHeight = 30, iconAnchorX = 15, iconAnchorY = 30),
|
|
67
|
+ purple = makeIcon(pinurl("purple"), iconWidth = 30,
|
|
68
|
+ iconHeight = 30, iconAnchorX = 15, iconAnchorY = 30)
|
|
69
|
+)
|
|
70
|
+
|
56
|
71
|
popups <- function(data) {
|
57
|
72
|
sprintf("<strong>%s</strong><br/>%s<br/>DHB: %s<br/>%s",
|
58
|
73
|
htmlEscape(data$name),
|
|
@@ -107,10 +122,10 @@ server <- function(input, output, session) {
|
107
|
122
|
output$medmap <- renderLeaflet({
|
108
|
123
|
gl <- leaflet(Geo2017)
|
109
|
124
|
gl <- addTiles(gl)
|
110
|
|
- gl <- addCircleMarkers(gl, lng = Geo2017$lon,
|
|
125
|
+ gl <- addMarkers(gl, lng = Geo2017$lon,
|
111
|
126
|
lat = Geo2017$lat,
|
112
|
127
|
popup = popups(Geo2017),
|
113
|
|
- col= "blue",
|
|
128
|
+ icon = piconlist["blue"],
|
114
|
129
|
label = Geo2017$name,
|
115
|
130
|
group = "locations"
|
116
|
131
|
)
|
|
@@ -126,26 +141,26 @@ server <- function(input, output, session) {
|
126
|
141
|
gl <- leafletProxy("medmap") %>%
|
127
|
142
|
clearMarkers()
|
128
|
143
|
if (input$selcol == "Snargleflagen") {
|
129
|
|
- gl <- addCircleMarkers(gl, lng = Geo2017$lon,
|
|
144
|
+ gl <- addMarkers(gl, lng = Geo2017$lon,
|
130
|
145
|
lat = Geo2017$lat,
|
131
|
146
|
popup = popups(Geo2017),
|
132
|
|
- col = snargcol(Geo2017$Snargle),
|
|
147
|
+ icon = piconlist[snargcol(Geo2017$Snargle)],
|
133
|
148
|
label = Geo2017$name,
|
134
|
149
|
group = "locations"
|
135
|
150
|
)
|
136
|
151
|
} else if (input$selcol == "DHB") {
|
137
|
|
- gl <- addCircleMarkers(gl, lng = Geo2017$lon,
|
|
152
|
+ gl <- addMarkers(gl, lng = Geo2017$lon,
|
138
|
153
|
lat = Geo2017$lat,
|
139
|
154
|
popup = popups(Geo2017),
|
140
|
|
- col = dhbcol(Geo2017$dhb_name),
|
|
155
|
+ icon = piconlist[dhbcol(Geo2017$dhb_name)],
|
141
|
156
|
label = Geo2017$name,
|
142
|
157
|
group = "locations"
|
143
|
158
|
)
|
144
|
159
|
} else {
|
145
|
|
- gl <- addCircleMarkers(gl, lng = Geo2017$lon,
|
|
160
|
+ gl <- addMarkers(gl, lng = Geo2017$lon,
|
146
|
161
|
lat = Geo2017$lat,
|
147
|
162
|
popup = popups(Geo2017),
|
148
|
|
- col= "blue",
|
|
163
|
+ icon = piconlist["blue"],
|
149
|
164
|
label = Geo2017$name,
|
150
|
165
|
group = "locations"
|
151
|
166
|
)
|