R Leaflet Language of the Map:How to Specify to Use English Language

R leaflet Language of the map : Can we specify to use English language

What you see on the map are Tiles, which are plain images generated by the Tile Server you specify (or use by default).

In your case, the Tile Server is OpenStreetMap: you will get the exact same tiles as on openstreetmap.org website (see for example: http://www.openstreetmap.org/#map=4/28.46/86.92)

As these are images, you will understand that you cannot change them.

Now you can change the Tile Server until you find one that serves images with names in the language you need.

Have a look at http://leaflet-extras.github.io/leaflet-providers/preview/ for example.

Setting map language to English in Openstreetmap with LeafletJS

The standard tile server of OSM tries to display labels in the local language whenever such data is available (local meaning the language of the country currently displayed, not your local language). The tiles, served by the tile server, already contain the labels, so you cannot remove them afterwards. But you can:

  • render them on your own (which requires suitable hardware) with an adjusted stylesheet, or
  • use tiles without labels and create a label overlay
  • try to see if there is a different tile server which only displays english labels. open mapquest for example has tiles based on OSM data where all labels are in english.
  • Map internationalization in the OSM wiki has some more examples

And always remember to comply with the tile usage policy of the tile server you choose.

Leaflet Map with Cities in English in R

If you have to stick to OpenSeaMap tiles then no, you can't change the language of the labels. Unfortunately these Labels are part of the raster images, they are not a separate layer.

However OpenSeaMap is composed of a base layer and a seamark layer (https://tiles.openseamap.org/seamark/). The base layer containing the map, city labels and so on is the OSM standard style and can be replaced by any other layer. So you can use a tile server with English labels plus the seamark layer on top of it.

If this is not a solution for you then how about adding an additional layer with English labels? So your users can at least switch to a layer with labels they can read, browse to the area they want to view, then switch back to OpenSeaMap tiles to see sea marks. Not a nice solution but it works.



Related Topics



Leave a reply



Submit