Search code examples
python-3.xfolium

Temperature numbers in map marker in Folium


I would like to add temperatures for a set of specific latitudes and longitudes in a map using folium, in folium we have markers and popups is there a way to add numbers like the one attached?

i have a simple code for markers and popups

import os
import folium
m = folium.Map(
    location=[27.6648, -81.5158],
    zoom_start=12,
    #tiles='Mapbox Bright'
)

folium.Marker([27.6648, -81.5158], popup='<i>test mountain</i>').add_to(m)
folium.Marker([27.2648, -81.4158], popup='<b>mountain2 Lodge</b>',icon=folium.Icon(color='red')).add_to(m)
m.save(os.path.join('simple_popups.html'))

i am getting markers and popups like this

Can we achieve this using folium?


Solution

  • you can use a DivIcon for this:

    icon = folium.DivIcon(html="your temperature here")
    folium.Marker([27.2648, -81.4158], icon=icon).add_to(m)