import os
import folium
print(folium.__version__)
0.3.0.dev
In this notebook we show a few illustrations of folium's plugin extensions.
This is a development notebook
Adds a button to enable/disable zoom scrolling.
from folium import plugins
m = folium.Map([45, 3], zoom_start=4)
plugins.ScrollZoomToggler().add_to(m)
m.save(os.path.join('results', 'Plugins_0.html'))
m
Adds a MarkerCluster layer on the map.
import numpy as np
N = 100
data = np.array(
[
np.random.uniform(low=35, high=60, size=N), # Random latitudes in Europe.
np.random.uniform(low=-12, high=30, size=N), # Random longitudes in Europe.
range(N), # Popups texts are simple numbers.
]
).T
m = folium.Map([45, 3], zoom_start=4)
plugins.MarkerCluster(data).add_to(m)
m.save(os.path.join('results', 'Plugins_1.html'))
m
m = folium.Map([45, 3], zoom_start=1)
plugins.Terminator().add_to(m)
m.save(os.path.join('results', 'Plugins_2.html'))
m
m = folium.Map([30, 0], zoom_start=3)
plugins.BoatMarker(
location=(34, -43),
heading=45,
wind_heading=150,
wind_speed=45,
color='#8f8'
).add_to(m)
plugins.BoatMarker(
location=(46, -30),
heading=-20,
wind_heading=46,
wind_speed=25,
color='#88f'
).add_to(m)
m.save(os.path.join('results', 'Plugins_3.html'))
m
m = folium.Map(location=[41.9, -97.3], zoom_start=4)
plugins.Fullscreen(
position='topright',
title='Expand me',
titleCancel='Exit me',
forceSeparateButton=True).add_to(m)
m.save(os.path.join('results', 'Plugins_4.html'))
m # Click on the top right button.