Я пытался найти решения, чтобы метки не перекрывались. Пожалуйста, обратитесь к картинке. Есть предложения?
карта
Воспроизводимый код:
gyms <-
structure(list(gym = c("Ashburton Pool and Recreation Centre",
"Brunswick Baths", "Casey Aquatic and Recreation Centre", "Hawthorn Aquatic & Leisure Centre",
"Macleod Recreation & Fitness Centre", "Northcote Aquatic & Recreation Centre",
"RecWest Footscray", "Aquahub", "Knox Leisureworks", "Waves Leisure Centre"
), suburb = c("Ashburton", "Brunswick", "Narre Warren", "Hawthorn",
"Macleod", "Northcote", "West Footscray", "Croydon", "Boronia",
"Highett"), lat = c(-37.8664, -37.77111, -38.02074, -37.82054,
-37.72407, -37.76906, -37.7946, -37.80099, -37.85752, -37.95049
), long = c(145.08518, 144.96023, 145.29975, 145.03313, 145.06882,
145.01182, 144.87968, 145.28072, 145.27868, 145.05513)), row.names = c(NA,
-10L), class = c("tbl_df", "tbl", "data.frame"))
library(leaflet)
leaflet() %>%
addTiles() %>%
addMarkers(lng = gyms$long, lat = gyms$lat,
label = gyms$suburb,
labelOptions = labelOptions(noHide = T, direction = 'auto')
, options = markerOptions(riseOnHover = T),
group = "gyms")