GithubHelp home page GithubHelp logo

Comments (16)

jesserobertson avatar jesserobertson commented on July 30, 2024 1

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.

wrobstory avatar wrobstory commented on July 30, 2024

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.

pybokeh avatar pybokeh commented on July 30, 2024

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.

ocefpaf avatar ocefpaf commented on July 30, 2024

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.

pybokeh avatar pybokeh commented on July 30, 2024

Sorry about leaving out what script I was running. See issue #92

from folium.

jdavidheiser avatar jdavidheiser commented on July 30, 2024

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.

ocefpaf avatar ocefpaf commented on July 30, 2024

@jesserobertson and @jdavidheiser can you report what browser are you testing?

from folium.

jdavidheiser avatar jdavidheiser commented on July 30, 2024

sorry for the delayed response - I saw this in both Firefox and Chrome on Mac OS X.

from folium.

ianozsvald avatar ianozsvald commented on July 30, 2024

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.

ocefpaf avatar ocefpaf commented on July 30, 2024

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.

jesserobertson avatar jesserobertson commented on July 30, 2024

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.

ianozsvald avatar ianozsvald commented on July 30, 2024

@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.

jesserobertson avatar jesserobertson commented on July 30, 2024

Sorry browser version might help: Iceweasel 31.7.0.

from folium.

ocefpaf avatar ocefpaf commented on July 30, 2024

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.

ocefpaf avatar ocefpaf commented on July 30, 2024

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.

jesserobertson avatar jesserobertson commented on July 30, 2024

@ocefpaf: thanks, this is awesome. :)

from folium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.