question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML - Folium - Not able to display map properly on the app despite unsafe_allow_html=True

See original GitHub issue

Summary

Amazing work folks!

I having the follow error when I try to insert a Folium map: "Make this Notebook Trusted to load map:File -> Trust Notebook

Steps to reproduce

import streamlit as st
import folium


st.title("Test")
m = folium.Map([38.8934, -76.9470], tiles="stamentoner", zoom_start=12)
#m.save("map test.html", close_file=True)
st.markdown(m._repr_html_(), unsafe_allow_html=True)

Expected behavior:

To have a view of the map in my Streamlit APP. I have commented a line that if its run, will save a .html, to be sure it’s not a Folium problem.

Actual behavior:

The APP is created. The title is shown, but I have this error where the map should be shown: "Make this Notebook Trusted to load map:File -> Trust Notebook

Is this a regression?

No idea. I have seen posts that seem to work for people, but I havent try it before: https://github.com/streamlit/streamlit/issues/1408

Debug info

  • Streamlit version: 0.60
  • Python version: 3.7.7
  • Conda and PIP for installing libraries.
  • OS version: Windows 10
  • Browser version: Chrome Versión 83.0.4103.61 (Build oficial) (64 bits)

Thanks for your time.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
randyzwitchcommented, Jul 20, 2020

A Streamlit Component for Folium was published today (by me):

https://github.com/randyzwitch/streamlit-folium

Going to close this issue in lieu of the component, as it’s more likely that the Component will be the method for doing this going forward rather than adding Folium as a dependency to base Streamlit.

1reaction
jwei-ccmpcommented, Jul 10, 2020

You could try insatll branca package of version 0.3.1 pip install branca==0.3.1

then restart your streamlit server . It approves my result although there are still some maps cannot be shown

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML - Folium - Not able to display map properly on the app ...
I am creating an app using streamlit and folium. (I used unsafe_allow_html=True to make sure the map could be displayed in the app)....
Read more >
python - Folium map not displaying - Stack Overflow
To display in the iPython notebook, you need to generate the html with the myMap._build_map() method, and then wrap it in an iFrame...
Read more >
Data Driven Maps With Python Folium & Leaflet.js - YouTube
Python Folium allows us to combine data and Python programming with the Leaflet.js map library to build powerful maps.
Read more >
Folium and heatmap is not opening in pycharm
I'm getting error in temp , folium map is not displaying any output and html page showing a blank page. I tried it...
Read more >
foliumap module - leafmap
A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found