36 add labels
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# !pip install leafmap
# !pip install leafmap
In [2]:
Copied!
import leafmap
import leafmap
Update the package if needed.
In [3]:
Copied!
# leafmap.update_package()
# leafmap.update_package()
Create an interactive map.
In [4]:
Copied!
data = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/us_states.json"
data = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/us_states.json"
In [5]:
Copied!
Map = leafmap.Map(center=[40, -100], zoom=4, add_google_map=False, layers_control=True)
Map = leafmap.Map(center=[40, -100], zoom=4, add_google_map=False, layers_control=True)
Labeling data.
In [6]:
Copied!
Map.add_labels(
data,
"id",
font_size="12pt",
font_color="blue",
font_family="arial",
font_weight="bold",
)
Map
Map.add_labels(
data,
"id",
font_size="12pt",
font_color="blue",
font_family="arial",
font_weight="bold",
)
Map
Out[6]:
Remove labels
In [7]:
Copied!
Map.remove_labels()
Map.remove_labels()
The folium plotting backend does not support removing labels.