# Set up for JupyterLite
try:
import piplite
await piplite.install('ipyleaflet')
except ImportError:
pass
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
heat = Heatmap(locations=create_random_data(1000), radius=20, blur=10)
m.add(heat)
for i in range(100):
heat.locations = create_random_data(1000)
time.sleep(0.1)
heat.radius = 30
heat.blur = 50
heat.max = 0.5
heat.gradient = {0.4: "red", 0.6: "yellow", 0.7: "lime", 0.8: "cyan", 1.0: "blue"}
heat.locations = [
[uniform(-80, 80), uniform(-180, 180), uniform(0, 1000)] for i in range(1000)
]