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

problems with display('file.geojson') #5

Open
Magdalena88 opened this issue May 16, 2016 · 7 comments
Open

problems with display('file.geojson') #5

Magdalena88 opened this issue May 16, 2016 · 7 comments

Comments

@Magdalena88
Copy link

Hi.

I'm trying to open my geojson file containing some polygons, applying exactly the code reported but the tool opens the browser without showing my data. If I manually upload my data on geojson.io they are correctly visualized.

Can you help me?
thanks

@jwass
Copy link
Owner

jwass commented May 16, 2016

Hi @Magdalena88,

I noticed the issue title is display('file.geojson'), is that how your code is using geojsonio?
If so, you first have to read the contents, then call display. Would this code from the README work?

with open('file.geojson') as f:
    contents = f.read()
    display(contents)

Does that work?

@Magdalena88
Copy link
Author

Thanks for your fast replay :)
Yes, I already tried that code and the issue is related to it. :(

@jwass
Copy link
Owner

jwass commented May 16, 2016

Would you feel comfortable posting the polygon data you're using somewhere along with the code that will reproduce the bug?

My guess is that when the data is too big, we can't use geojson.io this way - the Python library creates an anonymous Github gist then tells geojson.io to download it. When it's too big geojson.io can't download the entire gist. But it works when uploading the file locally. That's just a guess though.

@Magdalena88
Copy link
Author

Yes of course. The code I'm using is:

from geojsonio import display

with open('AOI.geojson') as f:
contents = f.read()
display(contents)
f.close()

I have the same issue also when trying to open a single polygon. I'm copying you the polygon data below:

{
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
30.84825076017768,
29.84449235157097
],
[
31.59090692089696,
29.83395854639918
],
[
31.58332490917348,
30.21149316913375
],
[
30.89876172494296,
30.24098056978401
],
[
30.84825076017768,
29.84449235157097
]
]
]
},
"type": "Feature",
"properties": {
"Name": "AOI",
"Description": ""
},
"id": 0
}
]
}

@jwass
Copy link
Owner

jwass commented May 18, 2016

@Magdalena88 Hmm...

Here are the contents of my script.py and AOI.geojson:

Running $python script.py opens up the window with a small rectangle in Egypt. I noticed your code has f.close() which isn't needed because of the with but it shouldn't affect the rest of the script. Can you confirm that this doesn't work on your end?

from geojsonio import display

with open('AOI.geojson') as f:
    contents = f.read()
    display(contents)

AOI.geojson:

{
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
30.84825076017768,
29.84449235157097
],
[
31.59090692089696,
29.83395854639918
],
[
31.58332490917348,
30.21149316913375
],
[
30.89876172494296,
30.24098056978401
],
[
30.84825076017768,
29.84449235157097
]
]
]
},
"type": "Feature",
"properties": {
"Name": "AOI",
"Description": ""
},
"id": 0
}
]
}

@jwass
Copy link
Owner

jwass commented May 18, 2016

P.S. if it still doesn't work, what OS and browser+version are you using?

@Magdalena88
Copy link
Author

my OS is Windoes 7 and I use Chrome 50.0.2661.102 :)

2016-05-18 16:19 GMT+02:00 Jacob Wasserman notifications@github.com:

P.S. if it still doesn't work, what OS and browser+version are you using?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#5 (comment)

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

2 participants