How do you cluster markers in Google Maps in R using googleway
package?
I tried to use the option add_markers("cluster = TRUE ") but without success
Here is a reproducible example and the map that I get:
library(googleway)
key <- "my_google_map_API"
df <- data.frame(
lat = c(45.77740319999999,45.77740319999999,46.77740319999999,46.77740319999999),
lon = c(4.855214400000023,4.955214400000023,4.855214400000023,4.955214400000023))
google_map(key = key, height = 600, search_box = T) %>%
add_markers(data = df,cluster = TRUE)
Thank you very much
A bug was found in the latest release version (v2.4) on CRAN which broke the clustering.
I've issued a fix in the development version (v2.5+), which you can install with
# library(devtools)
devtools::install_github("SymbolixAU/googleway")
Then it should work.
library(googleway)
key <- "map_key"
df <- data.frame(
lat = c(45.77740319999999,45.77740319999999,46.77740319999999,46.77740319999999),
lon = c(4.855214400000023,4.955214400000023,4.855214400000023,4.955214400000023)
)
google_map(key = key, height = 600, search_box = T) %>%
add_markers(data = df,cluster = TRUE)