jeudi 30 juillet 2015

Multiple trip headsigns for a route?

So I just noticed this in my application, but when I get a list of routes that services a stop, I get multiple trip_headsigns for a specific route, but they all run the same route when I get all the stops and the route shape. Am I missing something here? Or can somebody explain why? Here is how I get routes for specific stop:

    SELECT DISTINCT t.trip_headsign, r.route_short_name,r.route_long_name
    FROM stop_times st INNER JOIN trips t
    ON t.trip_id = st.trip_id
    INNER JOIN routes r
    ON r.route_id = t.route_id
    WHERE st.stop_id = <stop_id>

Here is how I get all the stops for a specific route returned by the query

      SELECT DISTINCT t.trip_id, s.stop_code, s.stop_name, s.stop_lat, s.stop_lon, t.shape_id, st.arrival_time
      FROM trips as t INNER JOIN stop_times as st
      ON st.trip_id = t.trip_id
      INNER JOIN stops as s ON s.stop_id = st.stop_id
      WHERE t.route_id = <route_id>
      AND t.service_id = "Weekdays"
      AND t.direction_id = <direction_id>

But as I said, I get multiple trip_headsigns as a query return from the first one, but when I run the second query I get the same route for all those trip_headsigns. Any help/comments/ideas are appreciated!

Aucun commentaire:

Enregistrer un commentaire