Bondify / gtfs_functions

Package with useful functions to create geo-spatial visualizations from a GTFS.
MIT License
114 stars 30 forks source link

Getting 'GeometryCollection' has no len() when running the cut_gtfs function #15

Closed ayronguerra closed 9 months ago

ayronguerra commented 1 year ago

I can run the previous functions that don't depend on the segments_gdf but I get the error when running the cut_gtfs function.

Screen Shot 2022-12-22 at 9 49 53 AM
yeying123 commented 1 year ago

I run into the same error message when processing various GTFS files. Any solution?

ayronguerra commented 1 year ago

Not yet, I emailed @Bondify but I haven't get a response. @yeying123 Please let me know if you solve the issue

yeying123 commented 1 year ago

@ayronguerra - Got time to look into the error this week. I think the issue was because the the result comes as the type 'GeometryCollection' and we need to add .geoms in order to read the length of it.

I modified the source code on my local to add .geoms, which becomes `if len(result.geoms) == len(trans_lines_all.geoms)-1: and it fixed the bug.

Narmina commented 1 year ago

@yeying123 I tried to fix with .geoms, but it ran into a different error: image

Any ideas?

Bondify commented 1 year ago

hi @Narmina , we are about to release an updated that deals with this issues. How urgent is this for you?

Narmina commented 1 year ago

Hello @Bondify, thank you! the sooner the better

Also, it is possible to work around the NumPy version issue, but there is an error: AttributeError: module 'numpy' has no attribute 'int'

yeying123 commented 1 year ago

@Narmina - if you want to do a quick fix on your end, try to replace it with d['segment'] = [s for s in result.geoms]. It should fix the error.

Bondify commented 1 year ago

please @Narmina @yeying123 @ayronguerra @Rikuoja check the last version of the package to see if the errors still appear. Please make sure to read how to use the with the new updates.