Search code examples
pythonlocalizationfolium

How do I get Folium to display maps in English?


I am starting to learn folium. The simplest thing, in Jupyter notebook, is to do:

import folium
m = folium.Map(location=[33.24, 36.98])
m

This displays a map all of whose place names are in Arabic. Is there a switch to get it to display the same places in English?


Solution

  • Folium itself doesn't have any language parameters, so you'd have to pick a map source that's all English.

    If you sign up for Mapbox, you can get access to plenty of tile sets for free including the all English mapbox.run-bike-hike tile set.

    Once you sign up for Mapbox, they'll give you an API token to use. Then, you can pass your API Key and tile set to Folium.

    import folium
    m = folium.Map(location=[33.24, 36.98],
                   tiles="https://api.mapbox.com/v4/mapbox.run-bike-hike/{z}/{x}/{y}.png?access_token=pk.XXX")
    m
    

    Replace pk.XXX with your own access token