from branca.element import Figure
lon, lat = -122.1889, 46.1991
location = [lat, lon]
zoom_start = 13
tiles = "OpenStreetMap"
import folium
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
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
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
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
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