Geocoding of publicly-available GP practice location in New Zealand

app.R 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. library(shiny)
  2. library(leaflet)
  3. library(dplyr)
  4. library(shinyWidgets)
  5. Geo2017 <- readRDS("Geo2017.rds")
  6. Geo2017$Snargle <- c(TRUE, rep(FALSE, 5))
  7. DHBs <- sort(unique(Geo2017$dhb_name))
  8. DHBs <- c(DHBs[DHBs != "Missing"], "Missing")
  9. ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
  10. tags$style(type = "text/css",
  11. "#medmap {
  12. height: 100% !important;
  13. posiiton: absolute;
  14. top: 0;
  15. left: 0;
  16. }
  17. #ddown {
  18. position: absolute;
  19. top: 0;
  20. right: 0;
  21. z-index: 10;
  22. }"),
  23. dropdownButton(
  24. strong("Not Implemented"), hr(),
  25. searchInput("mapsearch",
  26. placeholder = "Search GP practices by name",
  27. btnSearch = icon("search"),
  28. btnReset = icon("remove"),
  29. width = "100%"),
  30. hr(),
  31. radioButtons("selcol", "Colour by",
  32. choices = c("None",
  33. "DHB",
  34. "Snargleflagen")),
  35. hr(),
  36. checkboxInput("dhboverlay", "Show DHBs"),
  37. hr(),
  38. #pickerInput("dhbpicker",
  39. # label = "Show from DHBs",
  40. # choices = DHBs,
  41. # multiple = TRUE,
  42. # options = pickerOptions(size=3),
  43. # selected = DHBs),
  44. #hr(),
  45. actionLink("closedrop", label = "close", icon = icon("close"),
  46. style="float:right"),
  47. circle=FALSE, inputId = "ddown", right = TRUE,
  48. label = "Options", inline = FALSE),
  49. leafletOutput(outputId = "medmap")
  50. )
  51. server <- function(input, output) {
  52. output$medmap <- renderLeaflet({
  53. leaflet(Geo2017) %>%
  54. addTiles() %>%
  55. addMarkers(lng = Geo2017$lon,
  56. lat = Geo2017$lat,
  57. popup = Geo2017$name)
  58. })
  59. observeEvent(input$closedrop, {
  60. toggleDropdownButton("ddown")
  61. })
  62. }
  63. # Run the application
  64. shinyApp(ui = ui, server = server)