How to data source on an interactive map using tmap or leaflet in R?

Hello,

I want to add a data source to a map in tmap (at the lower-right corner). The tm_credits() works for static map, however, I got a message "Credits not supported in view mode". tm_credits() doesn't work for interactive maps.

Is there a function to do so? Thanks!

In the general leaflet.js environment the attribution control is shown by default in the lower right corner. It combines attribution attributes from individual layers and is not easily manipulated.

As far as I know there is no way to modify the attribution settings via the {tmap} package.

If creating maps via the {leaflet} package directly (i.e. not via {tmap}) you can add a custom text to the little grey attribution box commonly displayed in the lower right corner by setting text in the attribution argument of addTiles() call.

For example including

   addTiles(attribution = 'Eat mor chickin!')

Will lead to attribution along these lines:

Note that the attribution always starts with a link to leaflet, and continues with attribution of the tiles used (in this case OpenStreetMap).

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.