#!/usr/bin/env python # coding: utf-8 # You will need to install the below packages: # - `ipyleaflet` # - `geopandas` # In[ ]: from ipyleaflet import Map, GeoData import geopandas as gpd import fiona # In[ ]: # Visualize GPX data m = Map(center=[46.57608333, 8.89241667], zoom=17) path = "data/example.gpx" layers = fiona.listlayers(path) for layer in layers: gdf = gpd.read_file(path, driver="GPX", layer=layer) if gdf.empty: continue geo_data = GeoData( geo_dataframe=gdf, style={ "color": "black", "fillColor": "#3366cc", "opacity": 0.05, "weight": 1.9, "fillOpacity": 0.6, }, hover_style={"fillColor": "red", "fillOpacity": 0.2}, ) m.add(geo_data) m