#!/usr/bin/env python # coding: utf-8 # In[1]: import ipyleaflet as ipyl import ipywidgets as ipyw import json # In[2]: # Map and label widgets map = ipyl.Map(center=[53.88, 27.45], zoom=4) label = ipyw.Label(layout=ipyw.Layout(width='100%')) # geojson layer with hover handler with open('./europe_110.geo.json') as f: data = json.load(f) for feature in data['features']: feature['properties']['style'] = { 'color': 'grey', 'weight': 1, 'fillColor': 'grey', 'fillOpacity': 0.5 } layer = ipyl.GeoJSON(data=data, hover_style={'fillColor': 'red'}) def hover_handler(event=None, id=None, properties=None): label.value = properties['geounit'] layer.on_hover(hover_handler) map.add_layer(layer) ipyw.VBox([map, label])