python-visualization / folium

Python Data. Leaflet.js Maps.
https://python-visualization.github.io/folium/
MIT License
6.91k stars 2.22k forks source link

html maps no longer render #1114

Closed robsomething closed 5 years ago

robsomething commented 5 years ago

Hi, This might fall under "it is you" category, but all of a sudden my html maps code generated by folium a few weeks ago no longer work for me and i get a white background only. The maps were generated under folium 0.7 and i have the same issue even after upgrading to 0.83

My actual maps are pretty complex with added legends as an overlay, but the legends still render. Attaching generated html code for the python/Spyder version for the simple example below which I can't get to render either (just a white page).

Please add a code sample or a nbviewer link, copy-pastable if possible

using Jupyter: import folium m = folium.Map(location=[45.5236, -122.6750]) m

using Spyder in python: import folium m = folium.Map(location=[45.5236, -122.6750]) m.save('mapcheck.html')

jupyter folium example

html screenshot with legend overlay

mapcheck.html.zip

Problem description

Maps no longer render, for even the simplest one as in the example code above. I had some older maps that were generated using folium 0.7 that no longer render. Attached screenshot from Jupyter and generated hmtl code from my python run.

Expected Output

Would expect to see a full map of the US centered at 45, -122.

Output of folium.__version__

jlc-christie commented 5 years ago

@robsomething Haven't tested the actual code, but just downloading and opening the HTML map rendered perfectly fine for me. Might have been that one of the external libraries was down when you tried? Is it still not rendering? Also, have you tried different browsers? Rendered for me in the latest Chrome, macOS.

--edit-- Can confirm after testing that it does not render inline for a Python notebook, and printing the map object just returns <folium.folium.Map object at 0x121828c88> maybe somebody changed the __str__ function?

jlc-christie commented 5 years ago

Update: It may be a jupyter notebook problem, I got it rendering by manually rendering the html output of _reprhtml like so:

import folium
from IPython.core.display import HTML

m = folium.Map(location=[45.5236, -122.6750])
HTML(m._repr_html_())

And then it rendered properly. See image.

Screen Shot 2019-03-30 at 3 55 47 pm
robsomething commented 5 years ago

wow..so this is embarrassing...It s definitely not a folium bug. While I tried rendering the files on multiple platforms at work, I realized the issue might be "at work." It seems that IT installed some new filtering software and that is causing the html code not to execute. When I tried it on off the work network, it worked just fine.... thanks for the community to running a sanity check and getting me to check another environment :)

Conengmo commented 5 years ago

Good to hear you found the issue!