Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geojsonio.embed redirects me to geojson.io instead of embedding an Iframe in the notebook. #6

Open
wroscoe opened this issue May 29, 2017 · 3 comments

Comments

@wroscoe
Copy link

wroscoe commented May 29, 2017

I'm trying to embed a map in my Jupyter notebook. When I try to run the geojsonio.embed(geojson) function, the browser window is redirected to the geojson.io site. However when I embed any other site in an Iframe, it works fine.

This try's to redirect me.

import geojsonio, json

geojson = { "type": "FeatureCollection",
            "features": [
              { "type": "Feature",
                 "geometry": {
                   "type": "Polygon",
                   "coordinates": [
                     [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
                       [100.0, 1.0], [100.0, 0.0] ]
                     ]
                 },
                 "properties": {
                   "prop0": "value0",
                   }
                 }
               ]
             }

#redirects me to a geojsonio site
url = geojsonio.embed(json.dumps(geojson))

Using another URL the iframe functionality works as expected.

from IPython.display import IFrame 
url0 = 'http://donkeycar.com'
IFrame(url, width='100%', height=500)  
@aubreymoore
Copy link

I have the same problem.

@jwass
Copy link
Owner

jwass commented Nov 13, 2017

I can reproduce this. After trying to fix it, I think it's something with geojson.io and there might not be anything we can do from the Python side to get it to embed properly.

Creating a very simple webpage with geojson.io in an iframe demonstrates this.

<!DOCTYPE html>
<html>
  <head>
    <title>Test IFrame</title>
  </head>
  <body>
    <iframe src="http://geojson.io" height="400" width="100%"></iframe>
    Some content here
  </body>
</html>

@jwass
Copy link
Owner

jwass commented Nov 13, 2017

After digging into this a bit, this is the relevant commit to geojson.io which disables iframes:
mapbox/geojson.io@1a2f825

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants