1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- library(shiny)
- library(leaflet)
- library(dplyr)
- library(shinyWidgets)
-
- Geo2017 <- readRDS("Geo2017.rds")
- Geo2017$Snargle <- c(TRUE, rep(FALSE, 5))
-
- DHBs <- sort(unique(Geo2017$dhb_name))
- DHBs <- c(DHBs[DHBs != "Missing"], "Missing")
-
-
- ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
- tags$style(type = "text/css",
- "#medmap {
- height: 100% !important;
- posiiton: absolute;
- top: 0;
- left: 0;
- }
- #ddown {
- position: absolute;
- top: 0;
- right: 0;
- z-index: 10;
- }"),
- dropdownButton(
- strong("Not Implemented"), hr(),
- searchInput("mapsearch",
- placeholder = "Search GP practices by name",
- btnSearch = icon("search"),
- btnReset = icon("remove"),
- width = "100%"),
- hr(),
- radioButtons("selcol", "Colour by",
- choices = c("None",
- "DHB",
- "Snargleflagen")),
- hr(),
- checkboxInput("dhboverlay", "Show DHBs"),
- hr(),
- #pickerInput("dhbpicker",
- # label = "Show from DHBs",
- # choices = DHBs,
- # multiple = TRUE,
- # options = pickerOptions(size=3),
- # selected = DHBs),
- #hr(),
- actionLink("closedrop", label = "close", icon = icon("close"),
- style="float:right"),
- circle=FALSE, inputId = "ddown", right = TRUE,
- label = "Options", inline = FALSE),
- leafletOutput(outputId = "medmap")
- )
-
- server <- function(input, output) {
- output$medmap <- renderLeaflet({
- leaflet(Geo2017) %>%
- addTiles() %>%
- addMarkers(lng = Geo2017$lon,
- lat = Geo2017$lat,
- popup = Geo2017$name)
- })
-
- observeEvent(input$closedrop, {
- toggleDropdownButton("ddown")
- })
- }
-
- # Run the application
- shinyApp(ui = ui, server = server)
|