from ipyleaflet import *
m = Map(center=(52, 10), zoom=8, basemap=basemaps.OpenStreetMap.Mapnik)
Map(center=[52, 10], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_tex…
strava_all = basemap_to_tiles(basemaps.Strava.All)
m.add(strava_all)
Map(bottom=21848.0, center=[52, 10], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title…
# 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)
strava_water = basemap_to_tiles(basemaps.Strava.Water)
m.substitute_layer(strava_all, strava_water)
# 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(geo)
# Adding the control
m.add(LayersControl())
# Creating two maps side by side
import ipywidgets
ipywidgets.HBox([m, Map(center=[43.6, 1.44], zoom=10)])