Skip to content

Instantly share code, notes, and snippets.

@met
Created October 6, 2024 00:42
Show Gist options
  • Save met/74b234be20f201b6c5b964075e952d21 to your computer and use it in GitHub Desktop.
Save met/74b234be20f201b6c5b964075e952d21 to your computer and use it in GitHub Desktop.
Get line routes from static GTFS
SELECT
route_short_name, stop_name, route_long_name, stop_sequence, route_stops.route_id, route_stops.stop_id
FROM
read_csv_auto("route_stops.txt") as route_stops
INNER JOIN
read_csv_auto("routes.txt") as routes ON route_stops.route_id = routes.route_id
INNER JOIN
read_csv_auto("stops.txt") as stops ON route_stops.stop_id = stops.stop_id
WHERE
route_stops.direction_id = 0
ORDER BY
route_short_name ASC,
route_stops.stop_sequence ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment