Contents:
Bases: builtins.object
A class to gather all the GTFS files for a feed and store them in memory as Pandas data frames. Make sure you have enough memory! The stop times object can be big.
Create a Pandas data frame representing agency.txt and save it to self.agency.
Create all Pandas data frames necessary for a GTFS feed.
Create a Pandas data frame representing calendar.txt and save it to self.calendar. Create the service IDs from the distinct weekly activities of the service windows. Also save the dictionary service window ID -> service ID to self.service_by_window.
Create a Pandas data frame representing routes.txt and save it to self.routes. Also create a dictionary with structure route ID -> shape ID and save it to self.shape_by_route.
Create a Pandas data frame representing shapes.txt and save it to self.shapes. Routes without shapes in shapes.geojson will be ignored. Each route with a shape has one shape that is used for both directions of travel.
Will create self.routes if it does not already exist.
Create a Pandas data frame representing stop_times.txt and save it to self.stop_times.
Will create self.stops and self.trips if they don’t already exist.
Create a Pandas data frame representing stops.txt and save it to self.stops. Create one stop at the beginning (the first point) of each shape and one at the end (the last point) of each shape. This will create duplicate stops in case shapes share endpoints.
Will create self.routes if it does not already exist.
Will not create stops for routes without linestrings.
Create a Pandas data frame representing trips.txt and save it to self.trips. Trip IDs encode direction, service window, and trip number within that direction and service window to make it easy to compute stop times.
Will create self.calendar, self.routes, and self.shapes if they don’t already exist.
Will not create trips for routes with null linestrings.
Assuming all the necessary data frames have been created (as in create_all()), export them to CSV files to the given output directory. If as_zip is True, then instead write the files to a zip archive called gtfs.zip in the given output directory. If output_dir is None, then write to self.input_dir.
Return a dictionary of the form route ID -> Shapely linestring of shape. Route IDs without shapes in shapes.geojson will not appear in the dictionary. If use_utm == True, then return each linestring in in UTM coordinates. Otherwise, return each linestring in WGS84 longitude-latitude coordinates.
Will create self.routes if it does not already exist.
Return the duration of the time period between the first and second time string in the given units. Allowable units are ‘s’ (seconds), ‘min’ (minutes), ‘h’ (hours). Assume timestr1 < timestr2.
Get command line arguments, create feed, and export feed.
Parse command line options and return an object with two attributes: input_dir, a list of one input directory path, and output_file, a list of one output file path.
Given a time string of the form ‘%H:%M:%S’, return the number of seconds past midnight that it represents. In keeping with GTFS standards, the hours entry may be greater than 23. If mod24 == True, then return the number of seconds modulo 24*3600. If inverse == True, then do the inverse operation. In this case, if mod24 == True also, then first take the number of seconds modulo 24*3600.