#!/usr/bin/env python # coding: utf-8 # In[ ]: from __future__ import print_function # In[ ]: from ipyleaflet import * # In[ ]: m = Map(center=(52, 10), zoom=8, basemap=basemaps.Hydda.Full) m # In[ ]: strata_all = basemap_to_tiles(basemaps.Strava.All) m.add_layer(strata_all) # In[ ]: # mouse interaction handling from ipywidgets import Label label = Label() display(label) def handle_interaction(**kwargs): if kwargs.get('type') == 'mousemove': label.value = str(kwargs.get('coordinates')) m.on_interaction(handle_interaction) # In[ ]: strata_water = basemap_to_tiles(basemaps.Strava.Water) m.substitute_layer(strata_all, strata_water) # In[ ]: # Adding an overlay layer import json 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 } geo = GeoJSON(data=data, hover_style={'fillColor': 'red'}, name='Countries') m.add_layer(geo) # In[ ]: # Adding the control m.add_control(LayersControl())