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

GTFS feed won't load to df (calendar_dates file instead of calendar file) #56

Closed
MartijnVerhoeven opened this issue Jun 27, 2019 · 3 comments

Comments

@MartijnVerhoeven
Copy link

Hi,

My name is Martijn Verhoeven and I work for the City of Amsterdam. I am currently trying to apply the bay area demo to Amsterdam with a gtfs feed from our local transit authority GVB. However when trying to load the feed into a dataframe it gives the following error:

'ValueError: calendar.txt is a required GTFS tekst file and was not found in folder'

The feed does have a calendar_dates.txt file however, but I don't know how to apply the parameter calendar_dates_lookup=None to loading a feed to a dataframe.

Do you have any suggestions or python scripts to sort this out?

Kind regards,

Martijn Verhoeven

@sablanchard
Copy link
Contributor

sablanchard commented Jun 28, 2019

Hi @MartijnVerhoeven ,
No problem, you can use the script we use for the full integration tests for San Diego for your case so see the file: https://github.com/UDST/urbanaccess/blob/dev/urbanaccess/tests/integration/integration_sandiego.py

Note:

  1. until a future update removes the calendar.txt requirement, you should create a dummy file to bypass this issue by doing the following: https://github.com/UDST/urbanaccess/blob/dev/urbanaccess/tests/integration/integration_sandiego.py#L22-L33

  2. then you should examine your calendar_dates.txt file and see what columns and values you want to use to select trips from that match your desired operational schedule.

    • For instance see this example for San Diego in the same file above: https://github.com/UDST/urbanaccess/blob/dev/urbanaccess/tests/integration/integration_sandiego.py#L49-L54
    • Note the parameter:
      calendar_dates_lookup={'exception_note': ['FINAL', 'WD'], 'schedule_type': 'WD'}
      What this is doing is using the column exception_note and its getting all the service ids that have the values in the list: 'FINAL', 'WD' (in the case of San Diego this indicates final schedule version and weekday) and also get service ids that that have column schedule_type value of WD (in the case of San Diego this indicates weekday).

You should be all set after this. We have a more elegant solution for this planned in the pipeline for a future version but have not yet had time to implement it properly yet but this should suffice.

Ill keep this open until you can report back that you successfully got it to work for you.

@MartijnVerhoeven
Copy link
Author

MartijnVerhoeven commented Jul 3, 2019 via email

@sablanchard
Copy link
Contributor

Great to hear @MartijnVerhoeven ! Will close this issue then.

Yes you could export your nodes to a shapefile using something like this:

import geopandas as gpd
import shapely

point_gdf = gpd.GeoDataFrame(nodes_df, crs={'init': 'epsg:4326'},
                             geometry=[shapely.geometry.Point(xy) for xy in zip(nodes_df.x, nodes_df.y)])
point_gdf.to_file('net_nodes.shp')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants