86 add markers
In [1]:
Copied!
# %pip install -U "leafmap[vector]"
# %pip install -U "leafmap[vector]"
In [2]:
Copied!
from leafmap import leafmap
from leafmap import leafmap
Create an interactive map.
In [3]:
Copied!
m = leafmap.Map()
m
m = leafmap.Map()
m
Add a simple marker to the map.
In [4]:
Copied!
m.add_markers(markers=[40, -100], shape="marker")
m.add_markers(markers=[40, -100], shape="marker")
Add circle markers to the map.
In [5]:
Copied!
m.add_markers(markers=[[40, -100], [35, -110]], shape="circle")
m.add_markers(markers=[[40, -100], [35, -110]], shape="circle")
Customize circle markers.
In [6]:
Copied!
m.add_markers(
markers=[[40, -100], [35, -110]],
shape="circle",
radius=20,
color="red",
fill_color="#3388ff",
fill_opacity=0.5,
)
m.add_markers(
markers=[[40, -100], [35, -110]],
shape="circle",
radius=20,
color="red",
fill_color="#3388ff",
fill_opacity=0.5,
)
Add country polygons to the map.
In [7]:
Copied!
m = leafmap.Map()
countries = "https://open.gishub.org/data/world/countries.geojson"
m.add_geojson(countries, layer_name="Countries", info_mode=None)
m
m = leafmap.Map()
countries = "https://open.gishub.org/data/world/countries.geojson"
m.add_geojson(countries, layer_name="Countries", info_mode=None)
m
Add circle markers with popups to the map.
In [8]:
Copied!
url = "https://open.gishub.org/data/world/world_cities.geojson"
m.add_data(url, column="population", cmap="Blues", marker_radius=5, layer_name="Cities")
url = "https://open.gishub.org/data/world/world_cities.geojson"
m.add_data(url, column="population", cmap="Blues", marker_radius=5, layer_name="Cities")