Browse Source

add search etc

Petra Lamborn 3 years ago
parent
commit
6fa8a74f5d
2 changed files with 20 additions and 10 deletions
  1. 17
    10
      viz/app.R
  2. 3
    0
      viz/extras.R

+ 17
- 10
viz/app.R View File

115
                                 fillColor = startcols.res, 
115
                                 fillColor = startcols.res, 
116
                   layerId = ~SA22018_V1,
116
                   layerId = ~SA22018_V1,
117
                   label = shpf@data$SA22018__1,
117
                   label = shpf@data$SA22018__1,
118
-                  fillOpacity = 1) %>%
118
+                  fillOpacity = 1, group = "polys") %>%
119
       setView(174, -41, 6) %>%
119
       setView(174, -41, 6) %>%
120
-        addResetMapButton() %>%
120
+      addResetMapButton() %>%
121
+      addSearchFeatures("polys", 
122
+                        options = searchFeaturesOptions(
123
+                          hideMarkerOnCollapse = TRUE,
124
+                          autoCollapse = FALSE,
125
+                          openPopup = FALSE,
126
+                          zoom=11,
127
+                          position="topleft")) %>%
121
       addLegend(position = "topleft",
128
       addLegend(position = "topleft",
122
                 colors = c(tencols, "#808080"),
129
                 colors = c(tencols, "#808080"),
123
                 labels = transport.t, opacity = 1,
130
                 labels = transport.t, opacity = 1,
477
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
484
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
478
             pmp <- ""
485
             pmp <- ""
479
             if (ttype != 0) {
486
             if (ttype != 0) {
480
-              pmp <- sprintf("Primary mode of transport: %s", 
487
+              pmp <- sprintf("Most common mode of transport: %s", 
481
                              transport.t[ttype])
488
                              transport.t[ttype])
482
             }
489
             }
483
             HTML(sprintf("%s<p><em>%d people commute to employment from 
490
             HTML(sprintf("%s<p><em>%d people commute to employment from 
489
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
496
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
490
             pmp <- ""
497
             pmp <- ""
491
             if (ttype != 0) {
498
             if (ttype != 0) {
492
-              pmp <- sprintf("Primary mode of transport: %s", 
499
+              pmp <- sprintf("Most common mode of transport: %s", 
493
                              transport.t[ttype])
500
                              transport.t[ttype])
494
             }
501
             }
495
             HTML(sprintf("%s<p><em>%d people commute to employment in 
502
             HTML(sprintf("%s<p><em>%d people commute to employment in 
504
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
511
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
505
             pmp <- ""
512
             pmp <- ""
506
             if (ttype != 0) {
513
             if (ttype != 0) {
507
-              pmp <- sprintf("Primary mode of transport: %s", 
514
+              pmp <- sprintf("Most common mode of transport: %s", 
508
                              edu.t[ttype])
515
                              edu.t[ttype])
509
             }
516
             }
510
             HTML(sprintf("%s<p><em>%d people commute to education from 
517
             HTML(sprintf("%s<p><em>%d people commute to education from 
516
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
523
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
517
             pmp <- ""
524
             pmp <- ""
518
             if (ttype != 0) {
525
             if (ttype != 0) {
519
-              pmp <- sprintf("Primary mode of transport: %s", 
526
+              pmp <- sprintf("Most common mode of transport: %s", 
520
                              edu.t[ttype])
527
                              edu.t[ttype])
521
             }
528
             }
522
             HTML(sprintf("%s<p><em>%d people commute to education in 
529
             HTML(sprintf("%s<p><em>%d people commute to education in 
536
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
543
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
537
             pmp <- ""
544
             pmp <- ""
538
             if (ttype != 0) {
545
             if (ttype != 0) {
539
-              pmp <- sprintf("Primary mode of transport: %s", 
546
+              pmp <- sprintf("Most common mode of transport: %s", 
540
                              transport.t[ttype])
547
                              transport.t[ttype])
541
             }
548
             }
542
             HTML(sprintf("%s<p><em>%d people commute to employment 
549
             HTML(sprintf("%s<p><em>%d people commute to employment 
549
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
556
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
550
             pmp <- ""
557
             pmp <- ""
551
             if (ttype != 0) {
558
             if (ttype != 0) {
552
-              pmp <- sprintf("Primary mode of transport: %s", 
559
+              pmp <- sprintf("Most common mode of transport: %s", 
553
                              transport.t[ttype])
560
                              transport.t[ttype])
554
             }
561
             }
555
             HTML(sprintf("%s<p><em>%d people commute to employment 
562
             HTML(sprintf("%s<p><em>%d people commute to employment 
564
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
571
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
565
             pmp <- ""
572
             pmp <- ""
566
             if (ttype != 0) {
573
             if (ttype != 0) {
567
-              pmp <- sprintf("Primary mode of transport: %s", 
574
+              pmp <- sprintf("Most common mode of transport: %s", 
568
                              edu.t[ttype])
575
                              edu.t[ttype])
569
             }
576
             }
570
             HTML(sprintf("%s<p><em>%d people commute to education 
577
             HTML(sprintf("%s<p><em>%d people commute to education 
577
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
584
             ttype <- ifelse(is.na(fdf$MAX) || nrow(fdf) == 0, 0, fdf$MAX)
578
             pmp <- ""
585
             pmp <- ""
579
             if (ttype != 0) {
586
             if (ttype != 0) {
580
-              pmp <- sprintf("Primary mode of transport: %s", 
587
+              pmp <- sprintf("Most common mode of transport: %s", 
581
                              edu.t[ttype])
588
                              edu.t[ttype])
582
             }
589
             }
583
             HTML(sprintf("%s<p><em>%d people commute to education 
590
             HTML(sprintf("%s<p><em>%d people commute to education 

+ 3
- 0
viz/extras.R View File

112
   margin-bottom: 10px;
112
   margin-bottom: 10px;
113
   border-top: 1px solid #000;
113
   border-top: 1px solid #000;
114
 }
114
 }
115
+.leaflet-control-search {
116
+  box-shadow: none;
117
+}
115
 "
118
 "
116
 
119
 
117
 attribhtml <- '
120
 attribhtml <- '