rstudio / leaflet

R Interface to Leaflet Maps
http://rstudio.github.io/leaflet/
Other
805 stars 509 forks source link

addAwesomeMarkers with clusterOptions = markerClusterOptions() does not work without tiles added to the map #819

Open jzadra opened 1 year ago

jzadra commented 1 year ago

When producing a map without tiles, addAwesomeMarkers() does not work if clusterOptions = markerClusterOptions() is used (ie clusterOptions is not NULL).

If tiles are added, addAwesomeMarkers() works with clusterOptions = markerClusterOptions(). If no tiles are added, addAwesomeMarkers() works with only if clusterOptions = NULL.

The reason I am trying to get this to work without tiles is that I am using some JS in onRender() to use a leaflet plugin for ESRI vector tiles that has not been ported to R leaflet. And it has the same behavior as if no tiles were added.

#No tiles, clusterOptions = markerClusterOptions() ##NOT WORKING
leaflet(data = quakes[1:20,]) %>%
  addAwesomeMarkers(~long,
                    ~lat,
                    clusterOptions = markerClusterOptions(),
                    popup = ~as.character(mag),
                    label = ~as.character(mag))

image

#No tiles, clusterOptions = NULL
leaflet(data = quakes[1:20,]) %>%
  addAwesomeMarkers(~long,
                    ~lat,
                    clusterOptions = NULL, 
                    popup = ~as.character(mag),
                    label = ~as.character(mag))

image

#with Tiles, clusterOptions = markerClusterOptions()
leaflet(data = quakes[1:20,]) %>%
  addTiles() %>%
  addAwesomeMarkers(~long,
                    ~lat,
                    clusterOptions = markerClusterOptions(),
                    popup = ~as.character(mag),
                    label = ~as.character(mag))

image

trafficonese commented 2 weeks ago

duplicate of #809

This error ocurs in the browser console: image