|
@@ -66,14 +66,6 @@ ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
|
66
|
66
|
}"),
|
67
|
67
|
div(class = "dropdowncont",
|
68
|
68
|
dropdownButton(
|
69
|
|
- strong("Not Implemented"), hr(),
|
70
|
|
- strong("Not Implemented"), hr(),
|
71
|
|
- strong("Not Implemented"), hr(),
|
72
|
|
- strong("Not Implemented"), hr(),
|
73
|
|
- strong("Not Implemented"), hr(),
|
74
|
|
- strong("Not Implemented"), hr(),
|
75
|
|
- strong("Not Implemented"), hr(),
|
76
|
|
- strong("Not Implemented"), hr(),
|
77
|
69
|
strong("Not Implemented"), hr(),
|
78
|
70
|
searchInput("mapsearch",
|
79
|
71
|
placeholder = "Search GP practices by name",
|
|
@@ -96,7 +88,7 @@ ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
|
96
|
88
|
)
|
97
|
89
|
|
98
|
90
|
|
99
|
|
-server <- function(input, output) {
|
|
91
|
+server <- function(input, output, session) {
|
100
|
92
|
output$medmap <- renderLeaflet({
|
101
|
93
|
gl <- leaflet(Geo2017)
|
102
|
94
|
gl <- addTiles(gl)
|
|
@@ -136,6 +128,18 @@ server <- function(input, output) {
|
136
|
128
|
}
|
137
|
129
|
})
|
138
|
130
|
|
|
131
|
+ observeEvent(input$mapsearch, {
|
|
132
|
+ ms <- input$mapsearch
|
|
133
|
+ if (ms != "") {
|
|
134
|
+ dists <- as.vector(adist(ms, Geo2017$name, costs = c("in" = 1, "del" = 1, "sub" = 1), fixed = FALSE))
|
|
135
|
+ md <- which.min(dists)
|
|
136
|
+ updateSearchInput(session, inputId = "mapsearch", value = Geo2017$name[md])
|
|
137
|
+ leafletProxy("medmap") %>% setView(lng = Geo2017$lon[md],
|
|
138
|
+ lat = Geo2017$lat[md],
|
|
139
|
+ zoom = 13)
|
|
140
|
+ }
|
|
141
|
+ })
|
|
142
|
+
|
139
|
143
|
}
|
140
|
144
|
|
141
|
145
|
# Run the application
|