|
@@ -9,6 +9,11 @@ Geo2017$Snargle <- c(TRUE, rep(FALSE, 5))
|
9
|
9
|
DHBs <- sort(unique(Geo2017$dhb_name))
|
10
|
10
|
DHBs <- c(DHBs[DHBs != "Missing"], "Missing")
|
11
|
11
|
|
|
12
|
+dhbcols <- hcl.colors(length(DHBs))
|
|
13
|
+names(dhbcols) <- DHBs
|
|
14
|
+snargcols <- hcl.colors(2)
|
|
15
|
+names(snargcols) <- c(TRUE, FALSE)
|
|
16
|
+
|
12
|
17
|
|
13
|
18
|
ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
|
14
|
19
|
tags$style(type = "text/css",
|
|
@@ -62,11 +67,26 @@ ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
|
62
|
67
|
|
63
|
68
|
server <- function(input, output) {
|
64
|
69
|
output$medmap <- renderLeaflet({
|
65
|
|
- leaflet(Geo2017) %>%
|
66
|
|
- addTiles() %>%
|
67
|
|
- addMarkers(lng = Geo2017$lon,
|
|
70
|
+ gl <- leaflet(Geo2017)
|
|
71
|
+ gl <- addTiles(gl)
|
|
72
|
+ if (input$selcol == "Snargleflagen") {
|
|
73
|
+ gl <- addMarkers(gl, lng = Geo2017$lon,
|
|
74
|
+ lat = Geo2017$lat,
|
|
75
|
+ popup = Geo2017$name,
|
|
76
|
+ # color = snargcols[as.character(Geo2017$dhb_name)]
|
|
77
|
+ )
|
|
78
|
+ } else if (input$selcol == "DHB") {
|
|
79
|
+ gl <- addMarkers(gl, lng = Geo2017$lon,
|
|
80
|
+ lat = Geo2017$lat,
|
|
81
|
+ popup = Geo2017$name,
|
|
82
|
+ # color = dhbcols[Geo2017$dhb_name]
|
|
83
|
+ )
|
|
84
|
+ } else {
|
|
85
|
+ gl <- addMarkers(gl, lng = Geo2017$lon,
|
68
|
86
|
lat = Geo2017$lat,
|
69
|
87
|
popup = Geo2017$name)
|
|
88
|
+ }
|
|
89
|
+ gl
|
70
|
90
|
})
|
71
|
91
|
|
72
|
92
|
observeEvent(input$closedrop, {
|