Kaynağa Gözat

Change to coloured markers

search now works; haven't removed old search
Petra Lamborn 4 yıl önce
ebeveyn
işleme
cba9262d9f

+ 29
- 14
MedicalCentres/app.R Dosyayı Görüntüle

@@ -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
                      )

+ 6
- 6
MedicalCentres/pin-icon-blue.svg Dosyayı Görüntüle

@@ -25,9 +25,9 @@
25 25
      borderopacity="1.0"
26 26
      inkscape:pageopacity="0.0"
27 27
      inkscape:pageshadow="2"
28
-     inkscape:zoom="2.8284271"
28
+     inkscape:zoom="6.1319416"
29 29
      inkscape:cx="53.163145"
30
-     inkscape:cy="91.898375"
30
+     inkscape:cy="59.282278"
31 31
      inkscape:document-units="px"
32 32
      inkscape:current-layer="layer1"
33 33
      showgrid="false"
@@ -45,7 +45,7 @@
45 45
         <dc:format>image/svg+xml</dc:format>
46 46
         <dc:type
47 47
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
48
-        <dc:title></dc:title>
48
+        <dc:title />
49 49
       </cc:Work>
50 50
     </rdf:RDF>
51 51
   </metadata>
@@ -55,19 +55,19 @@
55 55
      id="layer1"
56 56
      transform="translate(0,-952.36216)">
57 57
     <circle
58
-       style="opacity:1;fill:#000080;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
58
+       style="opacity:1;fill:#0000ff;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
59 59
        id="path3336"
60 60
        cx="50"
61 61
        cy="977.36218"
62 62
        r="25" />
63 63
     <path
64
-       style="fill:#000080;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
64
+       style="fill:#0000ff;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
65 65
        d="M 26.8,986.36216 50,1052.3622 73.2,986.36216"
66 66
        id="path3338"
67 67
        inkscape:connector-curvature="0"
68 68
        sodipodi:nodetypes="ccc" />
69 69
     <circle
70
-       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
70
+       style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
71 71
        id="path3340"
72 72
        cx="50"
73 73
        cy="977.36218"

MedicalCentres/pin-icon-aqua.svg → MedicalCentres/pin-icon-pink.svg Dosyayı Görüntüle

@@ -15,7 +15,7 @@
15 15
    id="svg2"
16 16
    version="1.1"
17 17
    inkscape:version="0.91 r13725"
18
-   sodipodi:docname="pin-icon-aqua.svg">
18
+   sodipodi:docname="pin-icon-pink.svg">
19 19
   <defs
20 20
      id="defs4" />
21 21
   <sodipodi:namedview
@@ -55,19 +55,19 @@
55 55
      id="layer1"
56 56
      transform="translate(0,-952.36216)">
57 57
     <circle
58
-       style="opacity:1;fill:#00ffff;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
58
+       style="opacity:1;fill:#ff00ff;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
59 59
        id="path3336"
60 60
        cx="50"
61 61
        cy="977.36218"
62 62
        r="25" />
63 63
     <path
64
-       style="fill:#00ffff;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
64
+       style="fill:#ff00ff;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
65 65
        d="M 26.8,986.36216 50,1052.3622 73.2,986.36216"
66 66
        id="path3338"
67 67
        inkscape:connector-curvature="0"
68 68
        sodipodi:nodetypes="ccc" />
69 69
     <circle
70
-       style="opacity:1;fill:#1a1a1a;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
70
+       style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
71 71
        id="path3340"
72 72
        cx="50"
73 73
        cy="977.36218"