-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.R
58 lines (50 loc) · 1.76 KB
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
library(shinydashboard)
library(leaflet)
header <- dashboardHeader(title = "geodev")
sidebar <- dashboardSidebar(collapsed = TRUE
# ,
# sidebarMenu(
# br(),
# actionButton(inputId = "removeMarkers", label = "Remove markers", icon = icon("remove"), width = "85%")
# )
)
body <- dashboardBody(
# tags$style(type = "text/css", "#map {height: 100% !important;}"),
#
# div(class="outer",
# tags$head(
# # Include custom CSS
# includeCSS("styles.css")
# ),
leafletOutput("map")
# )
)
ui <- dashboardPage(header, sidebar, body)
server <- function(input, output) {
output$map <- renderLeaflet({
leaflet() %>%
addTiles() # add default tiles (comment this line when using code below)
# addProviderTiles(provider = providers$Stamen.Terrain) %>%
# setView(lng = 14.815333, lat = 46.119944, zoom = 7) %>%
# addMiniMap(
# tiles = providers$OpenStreetMap,
# toggleDisplay = TRUE) %>%
# addEasyButton(easyButton(
# icon="fa-crosshairs", title="Locate Me",
# onClick=JS("function(btn, map){ map.locate({setView: true}); }")))
})
# # Add marker when one clicks on map
# observeEvent(input$map_click, {
# click <- input$map_click
# pnt <- data.frame(lat = click$lat, lng = click$lng)
# leafletProxy(mapId = "map", data = pnt) %>%
# addCircleMarkers(group = "markers", popup = paste(paste("lat:", click$lat, "lng:", click$lng, sep = " ")))
# })
#
# # Remove markers when button is pressed
# observeEvent(input$removeMarkers, {
# leafletProxy(mapId = "map") %>%
# clearMarkers()
# })
}
shinyApp(ui, server)