import os
import folium
print(folium.__version__)
0.5.0+27.g2d457b0.dirty
from branca.element import Figure
lon, lat = -122.1889, 46.1991
location = [lat, lon]
zoom_start = 13
tiles = 'OpenStreetMap'
width, height = 480, 350
fig = Figure(width=width, height=height)
m = folium.Map(
location=location,
tiles=tiles,
width=width,
height=height,
zoom_start=zoom_start
)
fig.add_child(m)
fig.save(os.path.join('results', 'WidthHeight_0.html'))
fig
width, height = '100%', 350
fig = Figure(width=width, height=height)
m = folium.Map(
location=location,
tiles=tiles,
width=width,
height=height,
zoom_start=zoom_start
)
fig.add_child(m)
fig.save(os.path.join('results', 'WidthHeight_1.html'))
fig
width, height = 480, '100%'
fig = Figure(width=width, height=height)
m = folium.Map(
location=location,
tiles=tiles,
width=width,
height=height,
zoom_start=zoom_start
)
fig.add_child(m)
fig.save(os.path.join('results', 'WidthHeight_2.html'))
fig
width, height = '50%', '100%'
fig = Figure(width=width, height=height)
m = folium.Map(
location=location,
tiles=tiles,
width=width,
height=height,
zoom_start=zoom_start
)
fig.add_child(m)
fig.save(os.path.join('results', 'WidthHeight_3.html'))
fig
width, height = '150%', '100%'
try:
folium.Map(location=location, tiles=tiles,
width=width, height=height, zoom_start=zoom_start)
except ValueError as e:
print(e)
Cannot parse value 150.0 as '%'
width, height = '50%', '80p'
try:
folium.Map(location=location, tiles=tiles,
width=width, height=height, zoom_start=zoom_start)
except ValueError as e:
print(e)
Cannot parse value '80p' as '%'
width, height = width, height = 480, -350
try:
folium.Map(location=location, tiles=tiles,
width=width, height=height, zoom_start=zoom_start)
except ValueError as e:
print(e)
Cannot parse value -350.0 as 'px'
width, height = 480, 350
fig = Figure(width=width, height=height)
m = folium.Map(
location=location,
tiles=tiles,
width='100%',
height='100%',
zoom_start=zoom_start
)
fig.add_child(m)
fig.save(os.path.join('results', 'WidthHeight_4.html'))
fig