mittrees / Treepedia_Public

Treepedia package for public use
BSD 2-Clause "Simplified" License
199 stars 112 forks source link

OSMnx and Treepedia #1

Open TheodoreGalanos opened 6 years ago

TheodoreGalanos commented 6 years ago

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 commented 5 years ago

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

NoahFU commented 5 years ago

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

akselitoikka commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@luyuhao0326 I ran this code using py2.7

xiaojianggis commented 5 years ago

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 commented 4 years ago

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 commented 4 years ago

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. https://github.com/python-pillow/Pillow/pull/1151