mszell / bikenwgrowth

Source code for the paper "Growing urban bicycle networks", exploring algorithmically the limitations of urban bicycle network growth
https://GrowBike.Net
GNU Affero General Public License v3.0
70 stars 9 forks source link

ValueError: 'u' is not in list #5

Closed ManuelBanza closed 2 months ago

ManuelBanza commented 2 years ago

Hi,

Congratulations for this amazing project!!

I am running locally the project and on the notebook 02 when I try to Download and wrangle data I get this error:

imagem

Thank you

mszell commented 2 years ago

Thx! This error means you are reading an _edges.csv file that does not have "u" in its header line. My guess is that the file is empty? Maybe the data hasn't downloaded? I am not sure what the problem is. Instead of re-downloading, you could try reading in an existing file from the data repository: https://zenodo.org/record/5083049

The header (first line) of the file should look something like this: osmid,oneway,ref,highway,maxspeed,length,geometry,name,lanes,bridge,junction,tunnel,access,service,width,u,v,key u and v are, if I remember correctly, the osmids of the source and destination nodes that define that edge.

ManuelBanza commented 2 years ago

Hi Michael, thanks for the quick answer.

I was trying also other cities than the ones you did. I got the data correctly from the 01 for all the cites, but the header does not contain the u and v columns. For example in the file {city}_carall_edges I only have this:

osmid,oneway,lanes,name,highway,maxspeed,reversed,length,bridge,junction,ref,access,tunnel,width,geometry

imagem

Do you know why the v and u columns are missing?

Cheers

mszell commented 2 months ago

The reason is because something changed in a newer geopandas or osmnx version (one or both of the methods ox.simplify_graph or .to_csv) Now the function ox_to_csv needs in the two calls of .to_csv to use parameter index = True instead of index = False. I am working to get the code up to date to osmnx=1.9.4.

mszell commented 2 months ago

Thx, resolved here: https://github.com/mszell/bikenwgrowth/commit/777ec826b214ee85755bbdca420dcef0bc59ec33