Map Resizing
I'm kinda new to folium, so I may have just missed something obvious, but I haven't been able to find a folium feature to resize the map. I could change the javascript for the map, but as I've got about 10 different maps (and more to come) that are all being generated automatically using python, this doesn't seem like a good solution. I'd ideally want the map to dynamically respond based on the window size.
Is this already possible without changing the javascript? If not, it'd be a great feature.
@silentttone looking at the source here https://github.com/wrobstory/folium/blob/master/folium/folium.py#L53 you can pass in width and height of the map.
i have tested the following and it works...
map = folium.Map(width=500,height=500,location=[40, -99], zoom_start=4)
Does @birdage's reply answer your question?
I don't think we're going to have dynamically resizing maps for a while. I've got some major other structural issues to address first.
@wrobstory ive had some issue with the size of the map in an ipython notebook, i.e the map will be the size you request but the cell size containing the notebook wont be the height you request, instead there will be a scroll bar.
@birdage I am closing this. @silentttone issue seems to be unrelated to the notebook display like yours. We need to pass relative size (in %) for that (See #23).
(And I am working on your issue tight now :wink:, see #90)
You should use this: f = folium.Figure(width=1000, height=500) m = folium.Map(location= initial_location, tiles="openstreetmap", zoom_start=zoom_start_defined, min_zoom = min_zoom_defined).add_to(f)
If you set it in folium.Map - it reshapes the map itself, but window map is the same (at least that is so for Jupyter Notebook)
source: https://stackoverflow.com/questions/48789751/set-map-boundary-and-stop-endless-panning-in-a-loop-of-folium-map
You should use this: f = folium.Figure(width=1000, height=500) m = folium.Map(location= initial_location, tiles="openstreetmap", zoom_start=zoom_start_defined, min_zoom = min_zoom_defined).add_to(f)
If you set it in folium.Map - it reshapes the map itself, but window map is the same (at least that is so for Jupyter Notebook)
source: https://stackoverflow.com/questions/48789751/set-map-boundary-and-stop-endless-panning-in-a-loop-of-folium-map
Had the exact same issue as @silentttone , this worked perfectly. Thank you.
this worked for me @Singh1106 ! thank you :)
How do you fit the Folium map on mobile devices?
Right now it doesn't fit it, but the div does fit and the folium map is inside the div, but the folium map is not getting any effect from the css styling. If I do width less than 100% then it just moves right and leaves a white background on the left.
Folium Map example
I get this when mobile device Size: 412x914

I want this on mobile devices

I know I'm late to the party, but if you wanted to add your exact monitor size as the width as seen on this forum post: https://stackoverflow.com/questions/3129322/how-do-i-get-monitor-resolution-in-python
As an example:
import folium
from screeninfo import get_monitors
m = get_monitors()
m_width = m[0].width
m_height = m[0].height
map = folium.Map(width = m_width, height = m_height, location=[LAT, LNG],
zoom_start = ZOOMSTART, min_zoom = MINZOOM, max_bounds=True, tiles = GIVEN_TILE_SET);
Insert what you would like into the uppercase. Also, I'm not going to be using this for a frame, rather a full page, so I don't need that part, but please modify your code to make sure it is included if you need it.