I've been using the ggmap package to create figures that will go in journal articles for many years. These maps are a little harder to create than Leaflet maps, and as OpenStreetMap and Google have both shut down their tile APIs, getting background tiles that work for me has become more difficult. (Stamen is okay, but the selections don't always work).

I've seen ways to export leaflet maps as static images, but these often leave artifacts like zoom buttons that I definitely don't want in my paper. What is the best tool now (2019) for creating clean, publication-quality geographic images in R?

As a further complication, I usually write my articles in rmarkdown so that my figures can update with changes to the data, research, etc. Taking a screenshot of a leaflet map where I just crop out the things I don't want isn't ideal.

  • which OSM tile api is shutdown? Have google really shut theirs down or have they locked it down with an API key? Have you tried tmap?
    – Spacedman
    Commented Oct 5, 2019 at 12:58
  • Google has locked it with an API key. OpenStreetMap has locked its API from exporting in the way ggmap works, according to this issue Commented Oct 6, 2019 at 0:53
  • I just learned about tmap in my searching that prompted this question. I guess I want to make sure that I'm not missing anything else before I learn a new syntax. Commented Oct 6, 2019 at 0:54
  • tmap does not support basemaps in the non-interactive view, so I'm in basically the same boat as I was in with leaflet. Commented Oct 15, 2019 at 21:00

1 Answer 1


It is possible to use basemaps in the non-interactive mode of the tmap package. However, it requires two steps:

  1. Downloading/preparing raster data with three layers (RGB)
  2. Start making the map with tm_shape(my_rgb_data) + tm_rgb()

You can see some examples of using this approach at https://stackoverflow.com/a/56972352/2602477.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.