Display a segment in a map

This example will create a map and add a track to it.

Make this Notebook Trusted to load map: File -> Trust Notebook


from gpxplotter import add_segment_to_map, create_folium_map, read_gpx_file

# Define some properties for drawing the line:
line_options = {"color": "red", "weight": 8, "opacity": 0.5}

the_map = create_folium_map(tiles="kartverket_topo4")
for track in read_gpx_file("example1.gpx"):
    for i, segment in enumerate(track["segments"]):
        add_segment_to_map(the_map, segment, line_options=line_options)

# To store the map as a HTML page:
# the_map.save('map_000.html')

# To display the map in a Jupyter notebook:
the_map

Total running time of the script: (0 minutes 1.352 seconds)

Gallery generated by Sphinx-Gallery