Bondify / gtfs_functions

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

Allow running gtfs_functions with GTFS feeds that have missing optional fields #9

Closed Rikuoja closed 2 years ago

Rikuoja commented 2 years ago

Fixes #8 and #10

Direction_id is optional (https://developers.google.com/transit/gtfs/reference#tripstxt) and the whole shapes.txt file is optional (https://developers.google.com/transit/gtfs/reference#shapestxt) in the GTFS specification.

Therefore, this pull request will make most of the functions work even if direction_id, shape_id or both are missing.

Also, this pr makes stop_times a geodataframe. Trying to do geometry operations fails in some cases if stops is a geodataframe, but stop_times is a regular (non-geo)dataframe.

Frank94co commented 1 year ago

Hi, I found out that the commit didn't solve the problem, because a Bogota GTFS file (like the found out in https://storage.googleapis.com/gtfs-estaticos/GTFS-2022-08-24.zip), that also has no direction_id, threw me the following error: image

Thank you in advance.