-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample1.R
36 lines (17 loc) · 891 Bytes
/
example1.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
library(leaflet)
groupColours <- colorFactor(palette = "Set1", city_coord$cluster)
groups = as.character(unique(city_coord$cluster))
map = leaflet(city_coord) %>% addProviderTiles("CartoDB.DarkMatterNoLabels")
for (i in groups) {
d = city_coord[city_coord$cluster == i, ]
map = map %>% addCircleMarkers(data = d, lng = ~longitude, lat = ~latitude, radius = 1, weight = 2, opacity = 0.2,
popup = ~as.character(i), color = ~groupColours(cluster), group = i,
)
}
# map %>% addLayersControl(overlayGroups = groups)
map
testing_variable <- data.frame(lat = city_coord$latitude, lng = city_coord$longitude, tags = city_coord$tags )
mapqk <- testing_variable %>% leaflet() %>%
addProviderTiles("CartoDB.DarkMatterNoLabels") %>%
addCircleMarkers(clusterOptions = markerClusterOptions(), radius = 0.5)
mapqk