https://api.pugetsound.onebusaway.org/api/where/routes-for-agency/1.json?key=
Works fine. Then I click on a route and load the data for that route using:
https://api.pugetsound.onebusaway.org/api/where/schedule-for-route/<routeId>.json?key=
Works fine as well. I can dig out all of the stops and static arrival and departure times for stops along a particular direction.
Then, I take a particular stop id and load real-time data using:
https://api.pugetsound.onebusaway.org/api/where/arrivals-and-departures-for-stop/<stop_id>.json?key=
That also works fine. From the documentation:
https://developer.onebusaway.org/api/where/methods/arrivals-and-departures-for-stop
it says that I can get the real-time info for the route, and in particular the scheduledArrivalTime and scheduledDepartureTime in ms since unix epoch.
My question is this: when I compare the scheduledArrivalTime (scheduledDepartureTime is usually the same value) to what I get when I load the route, I get different answers. The times are not the same. Sometimes they are off by 10 minutes, which is curious.
I guess what my question really is is this: from those who've done something similar already (in javascript or Swift), what's the best method for doing this?
Thanks! Sorry if this is a dumb question that has been answered before.
Drew
{
"code" : 200,
"data" : {
"entry" : {
"arrivalsAndDepartures" : [
{
"numberOfStopsAway" : 9,
"predictedDepartureInterval" : null,
"lastUpdateTime" : 0,
"predictedDepartureTime" : 0,
"routeShortName" : "44",
"scheduledDepartureTime" : 1720415314000,
"situationIds" : [
],
"predictedOccupancy" : "",
"serviceDate" : 1720335600000,
"predictedArrivalTime" : 0,
"vehicleId" : "",
"frequency" : null,
"tripStatus" : {
"occupancyCapacity" : -1,
"occupancyCount" : -1,
"position" : {
"lat" : 47.667934000654007,
"lon" : -122.398323
},
"lastKnownOrientation" : 0,
"status" : "default",
"lastKnownDistanceAlongTrip" : 0,
"nextStopTimeOffset" : 3,
"occupancyStatus" : "",
"closestStop" : "1_18085",
"totalDistanceAlongTrip" : 8720.2389357926986,
"vehicleId" : "",
"closestStopTimeOffset" : 3,
"lastUpdateTime" : 0,
"phase" : "",
"nextStop" : "1_18085",
"predicted" : false,
"scheduleDeviation" : 0,
"scheduledDistanceAlongTrip" : 8720.2388630707283,
"vehicleFeatures" : [
],
"orientation" : 270,
"lastLocationUpdateTime" : 0,
"blockTripSequence" : 3,
"activeTripId" : "1_629475226",
"frequency" : null,
"serviceDate" : 1720335600000,
"distanceAlongTrip" : 0,
"situationIds" : [
]
},
"scheduledArrivalInterval" : null,
"arrivalEnabled" : true,
"tripId" : "1_562591026",
"blockTripSequence" : 4,
"routeLongName" : "",
"historicalOccupancy" : "",
"scheduledArrivalTime" : 1720415314000,
"status" : "default",
"scheduledTrack" : "",
"occupancyStatus" : "",
"actualTrack" : "",
"stopSequence" : 9,
"tripHeadsign" : "University Of Washington Medical Center Wallingford",
"predicted" : false,
"scheduledDepartureInterval" : null,
"stopId" : "1_75407",
"distanceFromStop" : 2979.4030910503388,
"departureEnabled" : true,
"predictedArrivalInterval" : null,
"routeId" : "1_100224",
"totalStopsInTrip" : 27
},
{
"numberOfStopsAway" : 9,
"predictedDepartureInterval" : null,
"lastUpdateTime" : 0,
"predictedDepartureTime" : 0,
"routeShortName" : "44",
"scheduledDepartureTime" : 1720416454000,
"situationIds" : [
],
"predictedOccupancy" : "",
"serviceDate" : 1720335600000,
"predictedArrivalTime" : 0,
"vehicleId" : "",
"frequency" : null,
"tripStatus" : {
"occupancyCapacity" : -1,
"occupancyCount" : -1,
"position" : {
"lat" : 47.667934252168607,
"lon" : -122.398323
},
"lastKnownOrientation" : 0,
"status" : "default",
"lastKnownDistanceAlongTrip" : 0,
"nextStopTimeOffset" : 1203,
"occupancyStatus" : "",
"closestStop" : "1_18085",
"totalDistanceAlongTrip" : 8720.2389357926986,
"vehicleId" : "",
"closestStopTimeOffset" : -357,
"lastUpdateTime" : 0,
"phase" : "",
"nextStop" : "1_18085",
"predicted" : false,
"scheduleDeviation" : 0,
"scheduledDistanceAlongTrip" : 8720.2108958796307,
"vehicleFeatures" : [
],
"orientation" : 270,
"lastLocationUpdateTime" : 0,
"blockTripSequence" : 11,
"activeTripId" : "1_562590346",
"frequency" : null,
"serviceDate" : 1720335600000,
"distanceAlongTrip" : 0,
"situationIds" : [
]
},
"scheduledArrivalInterval" : null,
"arrivalEnabled" : true,
"tripId" : "1_562591186",
"blockTripSequence" : 12,
"routeLongName" : "",
"historicalOccupancy" : "",
"scheduledArrivalTime" : 1720416454000,
"status" : "default",
"scheduledTrack" : "",
"occupancyStatus" : "",
"actualTrack" : "",
"stopSequence" : 9,
"tripHeadsign" : "University Of Washington Medical Center Wallingford",
"predicted" : false,
"scheduledDepartureInterval" : null,
"stopId" : "1_75407",
"distanceFromStop" : 2979.4310582414473,
"departureEnabled" : true,
"predictedArrivalInterval" : null,
"routeId" : "1_100224",
"totalStopsInTrip" : 27
}
],
"nearbyStopIds" : [
"1_29640"
],
"stopId" : "1_75407",
"situationIds" : [
]
},
"references" : {
"stops" : [
{
"parent" : "",
"id" : "1_75407",
"code" : "75407",
"locationType" : 0,
"lon" : -122.361046,
"routeIds" : [
"1_100224"
],
"staticRouteIds" : [
"1_100224"
],
"direction" : "SE",
"lat" : 47.667099,
"name" : "NW Market St & 3rd Ave NW",
"wheelchairBoarding" : "ACCESSIBLE"
},
{
"parent" : "",
"id" : "1_18085",
"code" : "18085",
"locationType" : 0,
"lon" : -122.398415,
"routeIds" : [
"1_100224"
],
"staticRouteIds" : [
"1_100224"
],
"direction" : "S",
"lat" : 47.667934000000002,
"name" : "32nd Ave NW & NW Market St",
"wheelchairBoarding" : "ACCESSIBLE"
},
{
"parent" : "",
"id" : "1_29640",
"code" : "29640",
"locationType" : 0,
"lon" : -122.361328,
"routeIds" : [
"1_100224"
],
"staticRouteIds" : [
"1_100224"
],
"direction" : "NW",
"lat" : 47.667763000000001,
"name" : "NW Market St & 3rd Ave NW",
"wheelchairBoarding" : "ACCESSIBLE"
}
],
"trips" : [
{
"routeId" : "1_100224",
"blockId" : "1_7253369",
"timeZone" : "",
"id" : "1_562591026",
"tripShortName" : "",
"serviceId" : "1_11248",
"shapeId" : "1_20044006",
"directionId" : "1",
"peakOffpeak" : 0,
"routeShortName" : "",
"tripHeadsign" : "University Of Washington Medical Center Wallingford"
},
{
"routeId" : "1_100224",
"blockId" : "1_7253369",
"timeZone" : "",
"id" : "1_629475226",
"tripShortName" : "",
"serviceId" : "1_11248",
"shapeId" : "1_11044004",
"directionId" : "0",
"peakOffpeak" : 0,
"routeShortName" : "",
"tripHeadsign" : "Ballard Wallingford"
},
{
"routeId" : "1_100224",
"blockId" : "1_7253368",
"timeZone" : "",
"id" : "1_562591186",
"tripShortName" : "",
"serviceId" : "1_11248",
"shapeId" : "1_20044006",
"directionId" : "1",
"peakOffpeak" : 0,
"routeShortName" : "",
"tripHeadsign" : "University Of Washington Medical Center Wallingford"
},
{
"routeId" : "1_100224",
"blockId" : "1_7253368",
"timeZone" : "",
"id" : "1_562590346",
"tripShortName" : "",
"serviceId" : "1_11248",
"shapeId" : "1_11044004",
"directionId" : "0",
"peakOffpeak" : 0,
"routeShortName" : "",
"tripHeadsign" : "Ballard Wallingford"
}
],
"situations" : [
],
"stopTimes" : [
],
"routes" : [
{
"url" : "https:\/\/kingcounty.gov\/en\/dept\/metro\/routes-and-service\/schedules-and-maps\/044.html",
"agencyId" : "1",
"color" : "",
"id" : "1_100224",
"longName" : "",
"shortName" : "44",
"description" : "Ballard - Montlake",
"nullSafeShortName" : "44",
"textColor" : "",
"type" : 3
}
],
"agencies" : [
{
"phone" : "206-553-3000",
"url" : "https:\/\/kingcounty.gov\/en\/dept\/metro",
"lang" : "EN",
"id" : "1",
"disclaimer" : "",
"timezone" : "America\/Los_Angeles",
"email" : "",
"fareUrl" : "https:\/\/kingcounty.gov\/en\/dept\/metro\/fares-and-payment\/prices",
"name" : "Metro Transit",
"privateService" : false
}
]
}
},
"text" : "OK",
"version" : 2,
"currentTime" : 1720414797520
}
--
You received this message because you are subscribed to the Google Groups "onebusaway-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onebusaway-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/onebusaway-developers/bda49390-46ab-45d6-b3b2-d8d460fea326n%40googlegroups.com.