Add icon

Add a directional icon to the map
The notebook demonstrates how to add a directional icon to the map.
Uncomment the following line to install leafmap if needed.
| # %pip install "leafmap[maplibre]"
|
| import leafmap.maplibregl as leafmap
|
To run this notebook, you will need an API key from MapTiler. Once you have the API key, you can uncomment the following code block and replace YOUR_API_KEY with your actual API key. Then, run the code block code to set the API key as an environment variable.
| # import os
# os.environ["MAPTILER_KEY"] = "YOUR_API_KEY"
|
| m = leafmap.Map(style="3d-terrain")
url = "https://github.com/opengeos/datasets/releases/download/hydrology/streams.geojson"
m.add_geojson(url, name="Streams")
image = "https://i.imgur.com/ZMMvXuT.png"
m.add_arrow(
source="Streams", image=image, icon_size=0.1, symbol_placement="line", minzoom=10
)
m.add_layer_control()
m
|
1
2
3
4
5
6
7
8
9
10
11
12
13 | m = leafmap.Map(style="3d-terrain")
url = "https://github.com/opengeos/datasets/releases/download/vector/hike_gps_trace_line.geojson"
m.add_geojson(url, name="Hiking Trail")
image = "https://i.imgur.com/ZMMvXuT.png"
m.add_arrow(
source="Hiking Trail",
image=image,
icon_size=0.1,
symbol_placement="line",
minzoom=10,
)
m.add_layer_control()
m
|