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

OSMnx and Treepedia #1

Open
TheodoreGalanos opened this issue Aug 30, 2018 · 8 comments
Open

OSMnx and Treepedia #1

TheodoreGalanos opened this issue Aug 30, 2018 · 8 comments

Comments

@TheodoreGalanos
Copy link

Hello!

First of all thank you so much for this project, is quite amazing!

I took a first try in generating a greenview index map for a smaller area. To do that, I used OSMnx to extract a graph from a location and then saved the shapefile (in what I think was the correct projection). All steps run ok, but I noticed I was getting always the same value of GVI (-166,667) for all coordinates which indicated immediately that there was something wrong with my input file.

Is there maybe something I'm missing, for example OSMnx shape files not proper inputs for treepedia? Is there an example of how the two would work together that you can share? I'm only asking since that would make for a very flexible and bespoke workflow for treepedia.

P.S.: If it heps I can share the .shp file I input later today.

Thanks in advance!

Kind regards,
Theodore.

@luyuhao0326
Copy link

@TheodoreGalanos I have the same issue. Did you find a solution for it yet?

@NoahFU
Copy link

NoahFU commented Nov 25, 2018

@luyuhao0326 I got the same issue as well, anyone find a solution?

@akselitoikka
Copy link

akselitoikka commented Nov 27, 2018

Hi @luyuhao0326 @TheodoreGalanos @NuozhouFU

I don't know if you solved this yet but the GVI value of -166,667 comes from these lines in the GreenView_Calculate.py script:

           # if the GSV images are not download successfully or failed to run, then return a null value
                except:
                     greenPercent = -1000
                       break

           # calculate the green view index by averaging six percents from six images
                greenViewVal = greenPercent/numGSVImg

I had the same issue and I got it fixed by re-installing the pymeanshift module that is used in segmenting the images.
I hope this was helpful.

Akseli

@luyuhao0326
Copy link

Hi @luyuhao0326 @TheodoreGalanos @NuozhouFU

I don't know if you solved this yet but the GVI value of -166,667 comes from these lines in the GreenView_Calculate.py script:

           # if the GSV images are not download successfully or failed to run, then return a null value
                except:
                     greenPercent = -1000
                       break

           # calculate the green view index by averaging six percents from six images
                greenViewVal = greenPercent/numGSVImg

I had the same issue and I got it fixed by re-installing the pymeanshift module that is used in segmenting the images.
I hope this was helpful.

Akseli

Hi Akesli, I will give that a try. Did you run it in py27 or 3?

@akselitoikka
Copy link

@luyuhao0326 I ran this code using py2.7

@xiaojianggis
Copy link

Hello!

First of all thank you so much for this project, is quite amazing!

I took a first try in generating a greenview index map for a smaller area. To do that, I used OSMnx to extract a graph from a location and then saved the shapefile (in what I think was the correct projection). All steps run ok, but I noticed I was getting always the same value of GVI (-166,667) for all coordinates which indicated immediately that there was something wrong with my input file.

Is there maybe something I'm missing, for example OSMnx shape files not proper inputs for treepedia? Is there an example of how the two would work together that you can share? I'm only asking since that would make for a very flexible and bespoke workflow for treepedia.

P.S.: If it heps I can share the .shp file I input later today.

Thanks in advance!

Kind regards,
Theodore.

You should check if you are using your own Google Street View image API key (https://developers.google.com/maps/documentation/streetview/usage-and-billing). The former key is expired because Google changed its pricing policy. The reason why we set negative value is used to tell users that the result is invalid. If you have too many invalid results, that means your images may not be properly downloaded.

@shreeraman96
Copy link

Thanks to the team for this very much needed library. I have been using this library for one of my projects and I faced the same issue.
I was using Python3 with some changes and i made few conversion changes. I fixed this issue by making a small change
instead of im = np.array(Image.open(StringIO(response.content)))
i changed this to
im = np.array(Image.open(BytesIO(response.content)))
and the issue got resolved and i was able to get proper values.
If you guys have any doubts you can look into the same library which i forked for my usage. I have updated all the changes that i have done to use the library

@y26805
Copy link

y26805 commented May 8, 2020

Thanks to the team for this very much needed library. I have been using this library for one of my projects and I faced the same issue.
I was using Python3 with some changes and i made few conversion changes. I fixed this issue by making a small change
instead of im = np.array(Image.open(StringIO(response.content)))
i changed this to
im = np.array(Image.open(BytesIO(response.content)))
and the issue got resolved and i was able to get proper values.
If you guys have any doubts you can look into the same library which i forked for my usage. I have updated all the changes that i have done to use the library

Nice! adding to this, it seems you can simply use Image.open() in Pillow without the BytesIO wrapping.
python-pillow/Pillow#1151

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

7 participants