|
@@ -82,6 +82,7 @@ ui <- fluidPage(
|
82
|
82
|
# Define server logic
|
83
|
83
|
server <- function(input, output) {
|
84
|
84
|
sel.SA2.code <- reactiveVal(0)
|
|
85
|
+ attribupdate <- FALSE
|
85
|
86
|
output$map <- renderLeaflet({
|
86
|
87
|
leaf <- leaflet(shpf, options = leafletOptions(minZoom = 3, maxZoom = 13)) %>%
|
87
|
88
|
addPolygons(color="#000", opacity = 1, weight=1,
|
|
@@ -191,22 +192,23 @@ server <- function(input, output) {
|
191
|
192
|
sel.SA2.code(ifelse(sel.SA2.code() == codetmp, 0, codetmp))
|
192
|
193
|
updateMap()
|
193
|
194
|
})
|
|
195
|
+ observeEvent(input$map_zoom, once=TRUE, {
|
|
196
|
+ if (!attribupdate) {
|
|
197
|
+ print(attribupdate)
|
|
198
|
+ shinyjs::html(selector=".leaflet-control-attribution.leaflet-control",
|
|
199
|
+ html = attribhtml)
|
|
200
|
+ attribupdate <<- TRUE
|
|
201
|
+ }
|
|
202
|
+ })
|
194
|
203
|
observeEvent(input$map_shape_mouseover, once=TRUE,{
|
195
|
|
- shinyjs::html(selector=".leaflet-control-attribution.leaflet-control",
|
196
|
|
- html = '
|
197
|
|
-<a href="http://leafletjs.com"
|
198
|
|
-title="A JS library for interactive maps">Leaflet</a> | <a
|
199
|
|
-href="https://datafinder.stats.govt.nz/data/category/census/2018/commuter-view/"
|
200
|
|
-title="Source data">
|
201
|
|
-StatsNZ</a> | <a href="https://petras.space/page/cv/" title="Hire me!">
|
202
|
|
-Petra Lamborn</a> | Numbers subject to <a
|
203
|
|
-href="http://archive.stats.govt.nz/about_us/legisln-policies-protocols/
|
204
|
|
-confidentiality-of-info-supplied-to-snz/safeguarding-confidentiality.aspx"
|
205
|
|
-title="A method of preserving confidentiality and anonymity">
|
206
|
|
-random rounding</a>
|
207
|
|
- '
|
208
|
|
- )
|
209
|
|
- })
|
|
204
|
+ # Backup
|
|
205
|
+ if (!attribupdate) {
|
|
206
|
+ print(attribupdate)
|
|
207
|
+ shinyjs::html(selector=".leaflet-control-attribution.leaflet-control",
|
|
208
|
+ html = attribhtml)
|
|
209
|
+ attribupdate <<- TRUE
|
|
210
|
+ }
|
|
211
|
+ })
|
210
|
212
|
observeEvent(input$radioinout, ignoreInit = TRUE, {
|
211
|
213
|
updateMap()
|
212
|
214
|
})
|