/
app.R
129 lines (110 loc) · 4.38 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
library(shiny)
library(leaflet)
library(shinythemes)
donut_icon <- makeIcon(
iconUrl = "https://68.media.tumblr.com/2d13322c7de894b243de18e8025c9eee/tumblr_mrpt9uX42B1sfhneko1_500.png",
iconWidth = 40,
iconHeight = 40
)
donut_data <- list(
shop = c("Jupiter Coffee & Donuts", "Kelly's Bakery", "Martin's Donuts",
"Milton's Donuts", "Mimi's Donuts & Bakery", "Oxford Doughnut Shoppe",
"Ross Bakery", "Stan the Donut Man", "The Donut Spot"),
lat = c(39.335671, 39.4209243, 39.4812661,
39.500268, 39.3993578, 39.5085681,
39.4224503, 39.3540151, 39.3390694),
lng = c(-84.5310157, -84.5937745, -84.461134,
-84.3693487, -84.6370217, -84.7521317,
-84.5791865, -84.3984114, -84.5616336),
popup = list(
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/jupiter-coffee-and-donuts-fairfield'>Jupiter Coffee & Donuts</a></b>",
"5353 Dixie Hwy",
"Fairfield, OH 45014"
),
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/kellys-bakery-hamilton'>Kelly's Bakery</a></b>",
"1335 Main St",
"Hamilton, OH 45013"
),
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/martins-donuts-trenton'>Martin's Donuts</a></b>",
"4 W State St",
"Trenton, OH 45067"
),
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/miltons-donuts-middletown'>Milton's Donuts</a></b>",
"3533 Roosevelt Blvd",
"Middletown, OH 45044"
),
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/mimis-donuts-and-bakery-hamilton'>Mimi's Donuts & Bakery</a></b>",
"2267 Millville Ave",
"Hamilton, OH 45013"
),
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/oxford-doughnut-shoppe-oxford'>Oxford Doughnut Shoppe</a></b>",
"120 S Locust St",
"Oxford, OH 45056"
),
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/ross-bakery-hamilton-2'>Ross Bakery</a></b>",
"1051 Eaton Ave",
"Hamilton, OH 45013"
),
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/stan-the-donut-man-west-chester'>Stan the Donut Man</a></b>",
"7967 Cincinnati Dayton Rd",
"West Chester, OH 45069"
),
paste(sep = "<br/>",
"<b><a href='https://www.yelp.com/biz/donut-spot-fairfield'>The Donut Spot</a></b>",
"5148 Pleasant Ave",
"Fairfield, OH 45014"
)
),
icon = makeIcon(iconUrl = "https://68.media.tumblr.com/2d13322c7de894b243de18e8025c9eee/tumblr_mrpt9uX42B1sfhneko1_500.png",
iconWidth = 60,
iconHeight = 60)
)
# Define UI for application that draws a histogram
ui <- fluidPage(theme = shinytheme("cerulean"),
navbarPage(title = "Butler County Donut Trail",
tabPanel("Interactive Map",
div(class="outer",
tags$head(
# Include our custom CSS
includeCSS("styles.css"),
includeScript("gomap.js")
),
leafletOutput("my_map", width = "100%", height = "100%"),
absolutePanel(id = "controls", class = "panel panel-default", fixed = TRUE,
draggable = TRUE, top = 60, left = "auto", right = 20, bottom = "auto",
width = 330, height = "auto",
h3("Welcome!"),
br(),
img(src = "donut_trail_logo.jpg", height = 200, width = 250),
br(),
br(),
br(),
p("This web app is designed to give users the ability to navigate their way through the Butler County Donut Trail!")))
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output, session) {
output$my_map <- renderLeaflet({
leaflet() %>%
addProviderTiles(providers$CartoDB.Positron) %>%
addMarkers(
lng = donut_data$lng,
lat = donut_data$lat,
label = donut_data$shop,
icon = donut_data$icon,
popup = donut_data$popup,
clusterOptions = markerClusterOptions()
)
})
}
# Run the application
shinyApp(ui = ui, server = server)