MIERUNE / gtfs-parser

parse and aggregate GTFS
https://pypi.org/project/gtfs-parser/
MIT License
7 stars 1 forks source link

read_routes() should return MultiLineStrings even if shape is not used #6

Closed takohei closed 4 months ago

takohei commented 4 months ago

Problem

Trips with the same route_id may have different stopping patterns, such as round-trip or sectional trips. However, read_routes() returns only one LineString per route if shape is not used.

Cause

Because read_routes() only refers to the first trip related to a route.

trip_id = route["trip_id"].unique()[0] https://github.com/MIERUNE/gtfs-parser/blob/479af5c941a1280f8d2f4858faaa9dff98145437/gtfs_parser/parse.py#L93-L111

Solution

read_routes() should return MultiLineStrings for each route containing LineStrings for each stop pattern.

Related Issue

The performance should also be improved. #1

Sample data

GTFS: Tokyo Toei Bus - ToeiBus-GTFS_20240421.zip