-1

I made this folium map converted it to HTML and named it html_map then added it to my a template in my Python app using {{ location_map | safe}} and trying to get rid of the bottom padding how can I do this.

map = folium.Map([0.376568,32.663343],width="100%",height="45%", zoom_start="13")
l = folium.FeatureGroup(name="Location")
folium.Marker(location=[0.376568,32.663343],popup="This is our office location 0.376568,32.663343, feel free to visit Namugongo,Mbalwa",icon=folium.Icon(color='green', icon='briefcase', prefix='fa')).add_to(l)
map.add_child(l)
map.add_child(folium.LayerControl(position='topleft',collapsed=True,))

html_map = map._repr_html_()

This is some of the HTML in html_map;

<div style="width:100%;"><div style="position:relative;width:100%;height:0;padding-bottom:60%;"><span style="color:#565656">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe src="about:blank" style="position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;" data-html=PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZX 
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 1
    Use your browsers Dev-Tools to determine where the padding is coming from. Then override it with CSS. – Kruspe Sep 29 '20 at 09:45

1 Answers1

1

I just find a way to do this. You need to modify the HTML constructed and push by _repr_html_().

You just avec to construct a new long-string as string are immutable in Python, thus, for the padding you can write:

 m=m._repr_html_() #updated
 m = m[:90] + '70' + m[92:]

This will replace the by default 60% padding to you desired value!

Henri Piot
  • 31
  • 5
  • i created a stack overflow account, got 50 rep just so i could upvote this and comment THANKS of all the time i wasted looking for an inbuilt solution - this turned out to be the most obvious and effective answer genius really! – BossTrolley Apr 19 '22 at 01:06