Comments (16)
I've noticed the issues with iPython.display.display as well.
Embedding the map in an IFrame manually fixes all of @jdavidheiser 's problems (see e.g. the display function below). Is the problem in the iPython.display library?
from IPython.display import HTML
def display(m, height=1000):
"""Takes a folium instance and embed HTML."""
m._build_map()
srcdoc = m.HTML.replace('"', '"')
embed = HTML('<iframe srcdoc="{0}" '
'style="width: 100%; height: {1}px; '
'border: none"></iframe>'.format(srcdoc, height))
return embed
from folium.
Ok, this isn't true- it's still working, just a little wonky. Let's leave this ticket open as "Make folium a little more Notebook friendly"
from folium.
I'm using Python 3.4 in virtual environment and ran the script from the terminal console. The html renders with Firefox, but not with Chrome or Chromium. I then ran the script within IPython notebook 3.0/Jupyter and same thing. html renders in Firefox, but not Chrome or Chromium. Can someone else try to duplicate this? Thanks!
from folium.
Lets start listing what is wonky so we can tackle this. I can on my machine running: ipython3, latest folium checkout, and chromium:
- The images seems "out of focus."
- Maps using the geo_json template seems to be shifted to the left.
PS: @pybokeh can you open a separate issue and provide a SSCCE for you case?
from folium.
Sorry about leaving out what script I was running. See issue #92
from folium.
I'm seeing something really odd happening - random tiles get shifted upward by a constant amount. Also, polygons markers are working, but regular points are not.
import folium
from IPython.display import display
folium.initialize_notebook()
map_1 = folium.Map(location=[45.372, -121.6972],tiles='Stamen Terrain')
# won't display marker
map_1.simple_marker([45.3288, -121.6625])
display(map_1)
# will display marker
map_5 = folium.Map(location=[45.5236, -122.6750], zoom_start=13)
map_5.polygon_marker(location=[45.5012, -122.6655],num_sides=3, radius=10)
display(map_5)
from folium.
@jesserobertson and @jdavidheiser can you report what browser are you testing?
from folium.
sorry for the delayed response - I saw this in both Firefox and Chrome on Mac OS X.
from folium.
Just to note - using Python 3.4, IPython Notebook 3.4 and folium 1.4, the display
solution in #90 (comment) works for me with Firefox 39 but the initialize_notebook
version in #90 (comment) renders a white rectangle only (no map). Maybe a note on the README could point folk using Notebooks to this solution? I'm on Linux (Mint 17.2) with Continuum's Anaconda 3.12.
from folium.
There is no reason to change the README. We have a bug displaying in the notebook and we have to fix it. The initialize_notebook()
function is broken and the display
function is a workaround.
from folium.
Sorry for my drive-by comment & delayed response @ocefpaf. I'm using Debian with Python 3.4 and 2.7 (same for both), IPython 3.1.0 and Folium 0.1.4. I see this on Chrome and Iceweasel (basically Firefox on Debain).
Happy to help test possible solutions. I agree that my hack is a workaround and Folium should display ok with initialize_notebook()
from folium.
@ocefpaf Hi Filipe. Fair enough. I only mention possibly noting this in the README because twice in 6 months I've had trouble with this, only now do I see that the display
function is a workaround, previously I'd hacked around for a while somewhat fruitlessly.
from folium.
Sorry browser version might help: Iceweasel 31.7.0.
from folium.
There is a lot of discussion here that does not relate to the original issue. So I am closing this one and opening #165 to keep track of the initialize_notebook()
future.
from folium.
PR #190 changed how we display the maps. All you need is to leave the map object as the last thing and the IPython/Jupyter HTML repr will take care of the rest.
(See: http://nbviewer.ipython.org/github/ocefpaf/folium_notebooks/tree/master/)
from folium.
@ocefpaf: thanks, this is awesome. :)
from folium.
Related Issues (20)
- NumPy 2.0 support HOT 4
- AttributeError: module 'folium' has no attribute 'plugins' HOT 1
- Marker with same ID results into broken html HOT 1
- Make Folium follow the Leaflet class hierarchy more closely HOT 4
- Add example pattern for pulling JsCode snippets from external javascript files HOT 9
- Support function objects in Leaflet options. HOT 3
- HTML does not work when run on mobile. HOT 2
- Blue Lines when using TimestampedGeoJson in Folium HOT 2
- Docs not quite representative of the real "latest" version? HOT 10
- No popup when clicking on specific icons (BeautifyIcon plugin) HOT 5
- Geocoder plugin not working in Google Chrome HOT 3
- Making a tooltip stay when clicked on a marker/shape HOT 1
- Add Code of Conduct HOT 1
- Realtime Circles have non-changing radii. HOT 2
- Adding Multiple Clusters to map HOT 3
- Add support to map ruler based on configured projection HOT 3
- Request for Assistance: Multi-Marker Selection and Value Summation Display in Folium Map HOT 1
- Using HeatMapWithTime together with TimestampedGeoJson HOT 2
- Fix FitOverlays when using multiple Tilesets HOT 3
- Release v0.17.0 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from folium.