Add HTML content to the map
This example shows how to add HTML content to the map using the add_html()
method.
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# %pip install "leafmap[maplibre]"
# %pip install "leafmap[maplibre]"
In [2]:
Copied!
import leafmap.maplibregl as leafmap
import leafmap.maplibregl as leafmap
In [3]:
Copied!
m = leafmap.Map(center=[-100, 40], zoom=3, style="positron")
html = """
<html>
<style>
body {
font-size: 20px;
}
</style>
<body>
<span style='font-size:100px;'>🚀</span>
<p>I will display 🚁</p>
<p>I will display 🚂</p>
</body>
</html>
"""
m.add_html(html, bg_color="transparent")
m
m = leafmap.Map(center=[-100, 40], zoom=3, style="positron")
html = """
🚀
I will display 🚁
I will display 🚂
""" m.add_html(html, bg_color="transparent") m