x=5 print(x)
from ipyleaflet import *
from ipywidgets import *
# A leaflet map with the Strava tile layer.
m = Map(center=(52, 10), zoom=8, basemap=basemaps.CartoDB.DarkMatter)
strata_all = basemap_to_tiles(basemaps.Strava.All)
m.add_layer(strata_all)
# Coordinates label
coordinates = Label(value='[]')
display(m)
display(coordinates)
# Wire the mouse position with the coordinates label
def handle_interaction(**kwargs):
if kwargs.get('type') == 'mousemove':
coordinates.value = str(kwargs.get('coordinates'))
m.on_interaction(handle_interaction)
from ipyleaflet import Map, Heatmap
from random import uniform
import time
def create_random_data(length):
"Return a list of some random lat/lon/value triples."
return [[uniform(-80, 80),
uniform(-180, 180),
uniform(0, 1000)] for i in range(length)]
m = Map(center=[0, 0], zoom=2)
m
Now we add a heatmap:
heat = Heatmap(locations=create_random_data(1000), radius=20, blur=10) m.add_layer(heat)
Finally, we add some animation to our heatmap:
for i in range(100):
heat.locations = create_random_data(1000)
time.sleep(0.1)