Note
Go to the end to download the full example code
Track colored by heart rate
This example will create a map and color the track according to the measured heart rate.
import folium
from gpxplotter import (
add_all_tiles,
add_segment_to_map,
create_folium_map,
read_gpx_file,
)
the_map = create_folium_map(tiles="kartverket_topo4")
# Add pre-defined tiles:
add_all_tiles(the_map)
for track in read_gpx_file("example1.gpx"):
for i, segment in enumerate(track["segments"]):
add_segment_to_map(the_map, segment, color_by="hr")
# Add layer control to change tiles:
folium.LayerControl(sortLayers=True).add_to(the_map)
# To store the map as a HTML page:
# the_map.save('map_001.html')
# To display the map in a Jupyter notebook:
the_map
Total running time of the script: (0 minutes 1.231 seconds)