4

I am creating maps for offline use using Leaflet for R and OpenStreetMap, adding information such as points of interest, and saving them as png files. This works well, but I would like to be able to adjust the font size on the OpenStreetMap basemap layer. EDIT This is because for very large maps (one I am working on is 4,500 pixels square) the text is so small as to be unreadable, even though the road network is visible. For example, this code:

require(leaflet)
require(mapview)
require(webshot)

m <- leaflet() %>% 
    setView(lng = -0.134509, lat = 51.509898, zoom = 17) %>%
    addTiles(group = "OpenStreetMap")
    
mapshot(m, file = file.path("c:\\Temp\\stack1.png"), vwidth = 500, vheight = 500)

produces this output:

Leaflet for R

In this image, I want to be able to change (say) the size of the font used to display "Jermyn Street". I have experimented with zoomOffset and tileSize, like this:

m <- leaflet() %>% 
    setView(lng = -0.134509, lat = 51.509898, zoom = 17) %>%
    addTiles(group = "OpenStreetMap",
             tileOptions(tileSize = 512,
                         zoomOffset = -1))

So far, all combinations I have tried result in blank output, like the image below. Is it even possible to change the basemap font on such tiles? (I would be open to using a different tile provider, if that helped.)

Blank

SlowLearner
  • 7,907
  • 11
  • 49
  • 80

1 Answers1

2

Not by passing arguments to a tile server you can’t. You’ll have to run your own tile server configured with larger text size or look for a map style/theme with larger text size.

You can refer to https://help.openstreetmap.org/questions/29621/how-to-increase-font-size-when-viewing-osm

rbasa
  • 452
  • 3
  • 5