Yttem
Yttem

Reputation: 1

How to Retrieve Intermediate Tram/Bus Stop Times in Unix Time Format Using OpenTripPlanner2 GraphQL API?

I am using the OpenTripPlanner GraphQL API for trip planning and need to extract detailed intermediate stop times in Unix time format for a tram route included in a multi-modal journey. The journey includes walking and then taking a tram. I would like to obtain a list of all stops the tram will make and the exact times it will reach these stops in Unix time format.

Could anyone help me modify my GraphQL query to include this information? Here’s a basic structure of what I have been using, but I need to specifically retrieve the tram's intermediate stops and their expected arrival times:

query GetTripPlan {
  plan(
    from: {lat: 47.99425, lon: 7.8448483}
    to: {lat: 48.01483175534417, lon: 7.81753190037756}
    date: "2024-02-13"
    time: "10:12:00"
    transportModes: [{mode: WALK}, {mode: TRAM}]
    numItineraries: 1
  ) {
    itineraries {
      legs {
        mode
        duration
        distance
        from {
          name
        }
        to {
          name
        }
        intermediateStops {
          name
          lat
          lon
        }
      }
    }
  }
}

I tried stoptimesWithoutPatterns and it did give me the general stopTimes, but not the stopTime particular to my trip.

Upvotes: 0

Views: 43

Answers (0)

Related Questions