Search code examples
python-3.xfolium

Creating marker on map using Folium results in blank HTML page


I tried to create a Map using folium library in python3. It work's fine until i add a Marker to the map. On adding Marker the output results in just a blank HTML page.

import folium

map = folium.Map(location=[20.59,78.96], tiles = "Mapbox Bright")

folium.Marker([26.80,80.76],popup="Hey, It's Moradabad").add_to(map)
map.save("mapOutput.html")

Solution

  • @MCO is absolutely correct.

    I like to leverage html.escape() to handle the problem characters like so

    import folium
    import html
    
    map = folium.Map(location=[20.59,78.96], tiles = "Mapbox Bright")
    
    folium.Marker([26.80,80.76],popup=html.escape("Hey, It's Moradabad")).add_to(map)
    map.save("mapOutput.html")