-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_map_html_file.R
More file actions
26 lines (15 loc) · 940 Bytes
/
generate_map_html_file.R
File metadata and controls
26 lines (15 loc) · 940 Bytes
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
list.of.packages <- c("leaflet", "htmlwidgets")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
# Start Script Here: ------------------------------------------------------
library(leaflet)
my.path = '/cloud/project/lab7/assignment.csv'
df = read.csv(my.path)
popup <- paste("<div class='leaflet-popup-scrolled' style='max-width:600px;max-height:300px'><b>",
'<a href=', df$InfoURL, ' target="_blank"> <h2 align="center"><strong>', df$Name, "</strong></h2></a><br>",
"</b>", df$Description, '<br><br><center><img src="', df$ImageURL, '" height="150px" width="200px" border="8"></center><br> </div>')
map = leaflet() %>%
addTiles( ) %>%
addMarkers(data = df, lat = df$Latitude, lng = df$Longitude, popup = popup )
map
htmlwidgets::saveWidget(map, file = paste0(dirname(my.path), "/map.html"))