Sfoglia il codice sorgente

Remove DHB boundary overlay

Petra Lamborn 4 anni fa
parent
commit
44109a0131
1 ha cambiato i file con 5 aggiunte e 32 eliminazioni
  1. 5
    32
      MedicalCentres/app.R

+ 5
- 32
MedicalCentres/app.R Vedi File

@@ -4,9 +4,6 @@ library(leaflet)
4 4
 library(dplyr)
5 5
 library(shinyWidgets)
6 6
 library(htmltools)
7
-library(rgdal)
8
-library(rgeos)
9
-library(ggfortify)
10 7
 
11 8
 leafcols <- c("blue", "red", "darkred", "lightred",
12 9
           "orange", "beige", "green", "darkgreen",
@@ -36,8 +33,6 @@ snargcol <- function(snarg) {
36 33
     sdf
37 34
 }
38 35
 
39
-dhb2015 <- readRDS("dhb2015.rds")
40
-
41 36
 popups <- function(data) {
42 37
 sprintf("<strong>%s</strong><br/>%s<br/>DHB: %s<br/>%s",
43 38
         htmlEscape(data$name),
@@ -70,7 +65,6 @@ ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
70 65
                }"),
71 66
     div(class = "dropdowncont",
72 67
     dropdownButton(
73
-      strong("Not Implemented"), hr(),
74 68
       searchInput("mapsearch",
75 69
                   placeholder = "Search GP practices by name",
76 70
                   btnSearch = icon("search"), 
@@ -82,8 +76,6 @@ ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
82 76
                                "DHB affiliation" = "DHB",
83 77
                                "Snargleflagen" = "Snargleflagen")),
84 78
       hr(),
85
-      checkboxInput("dhboverlay", "Show DHB boundaries"),
86
-      hr(),
87 79
       actionLink("closedrop", label = "close", icon = icon("close"),
88 80
                  style="float:right"),
89 81
       circle=FALSE, inputId = "ddown", right = TRUE,
@@ -94,15 +86,12 @@ ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
94 86
 
95 87
 server <- function(input, output, session) {
96 88
     output$medmap <- renderLeaflet({
97
-        gl <- leaflet(Geo2017) %>%
98
-          addMapPane("polygons", zIndex = 420) %>%
99
-          addMapPane("markers", zIndex = 430)
89
+        gl <- leaflet(Geo2017)
100 90
         gl <- addTiles(gl)
101 91
         gl <- addCircleMarkers(gl, lng = Geo2017$lon,
102 92
                    lat = Geo2017$lat,
103 93
                    popup = popups(Geo2017),
104
-                   col= "blue",
105
-                   #pathOptions(pane = "markers")
94
+                   col= "blue"
106 95
                    )
107 96
         gl
108 97
     })
@@ -118,24 +107,19 @@ server <- function(input, output, session) {
118 107
           gl <- addCircleMarkers(gl, lng = Geo2017$lon,
119 108
                      lat = Geo2017$lat,
120 109
                      popup = popups(Geo2017),
121
-                     # color = snargcols[as.character(Geo2017$dhb_name)]
122
-                     col = snargcol(Geo2017$Snargle),
123
-                     #pathOptions(pane = "markers")
110
+                     col = snargcol(Geo2017$Snargle)
124 111
                      )
125 112
       } else if (input$selcol == "DHB") {
126 113
           gl <- addCircleMarkers(gl, lng = Geo2017$lon,
127 114
                      lat = Geo2017$lat,
128 115
                      popup = popups(Geo2017),
129
-                     # color = dhbcols[Geo2017$dhb_name]
130
-                     col = dhbcol(Geo2017$dhb_name),
131
-                     #pathOptions(pane = "markers")
116
+                     col = dhbcol(Geo2017$dhb_name)
132 117
                      )
133 118
       } else {
134 119
           gl <- addCircleMarkers(gl, lng = Geo2017$lon,
135 120
                      lat = Geo2017$lat,
136 121
                      popup = popups(Geo2017),
137
-                     col= "blue",
138
-                     #pathOptions(pane = "markers")
122
+                     col= "blue"
139 123
                      )
140 124
       }
141 125
     })
@@ -155,17 +139,6 @@ server <- function(input, output, session) {
155 139
                                          zoom = 13)
156 140
       }
157 141
     })
158
-    observeEvent(input$dhboverlay, {
159
-      if (input$dhboverlay) {
160
-        leafletProxy("medmap") %>% addPolygons(data = dhbsub, fill = FALSE,
161
-                                               color = "#000000",
162
-                                               weight = 2,
163
-                                               #pathOptions(pane = "polygons")
164
-                                               )
165
-      } else {
166
-        leafletProxy("medmap") %>% clearShapes()
167
-      }
168
-    })
169 142
 
170 143
 }
171 144