Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Leaflet custom attribution string

When using the R leaflet package, how can I add something additional to the attribution string (i.e. the "Leaflet | ..." in the bottom right corner)?

For example, I how would I add something like "data source: ..." to the attribution text on this map:

leaflet(data = quakes[1:20,]) %>% 
  addTiles() %>%
  addMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag))
like image 955
Matt SM Avatar asked Sep 19 '26 22:09

Matt SM


1 Answers

As @rensa suspects, their second option does indeed embed and fetch both tile sets. However, the setting a blank urlTemplate seems to stop it:

leaflet(data = quakes[1:20,]) %>% 
  addProviderTiles(providers$OpenStreetMap.Mapnik) %>%
  addTiles(urlTemplate = "", attribution = 'I did this, you hear?! Also Leaflet.')
like image 193
Jamie Lentin Avatar answered Sep 21 '26 10:09

Jamie Lentin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!