I'm working with a map created using python, folium, and geojson, similar to this one.
However, instead of this image being an interactive HTML document, I would rather simply export it to png or svg.
Using the syntax:
m = folium.Map( # etc..)
m.save("filename.png")
Saves a file, but it is still HTML, rather than png. What's the correct output command to render not-to-html?
I use this:
... where m is my map object. And 5 is the time (seconds) to render the map.
import io
from PIL import Image
img_data = m._to_png(5)
img = Image.open(io.BytesIO(img_data))
img.save('image.png')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With