Skip to content

36 add labels

image Open in Colab

Uncomment the following line to install leafmap if needed.

1
# !pip install leafmap
1
import leafmap

Update the package if needed.

1
# leafmap.update_package()

Create an interactive map.

1
data = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/us_states.json"
1
Map = leafmap.Map(center=[40, -100], zoom=4, add_google_map=False, layers_control=True)

Labeling data.

1
2
3
4
5
6
7
8
9
Map.add_labels(
    data,
    "id",
    font_size="12pt",
    font_color="blue",
    font_family="arial",
    font_weight="bold",
)
Map

Remove labels

1
Map.remove_labels()