Page 1 of 1

ETA at last Waypoint (xRoute2)

Posted: Thu Sep 05, 2024 3:49 pm
by Bernd Welter
Hi guys,

I've been asked for a proper ETA calculation in the context of xRoute2 based on the routeResponse.

com.ptvgroup.xserver.xroute.RouteResponse.
ETA xRoute2.png
The sample calcutales a simple route is based on
  • 4 waypoints, each with 3600 seconds service duration.
  • No break- and rest rules (not relevant for the story)
SO here are our questions:
  • First remark: the subsequence of "TourEvent/Service" and "Waypoint" is
    • For the last waypoint the waypoint is listed AFTER the corresponding service.
    • For all other waypoints the Service appears in the array AFTER the Waypoint.
    That's documented in TechnicalConcept.RouteEvents
  • But what I don't get: Why is the last service event's "startsAt" given with a value BEFORE the arrival? Or is the definition of the last waypoint's event more like a "the last thing that happens on a route is the last waypoint" and therefore the "Arrival time" is supposed to be derived via "LastWaypoint.StartsAt - LastService.Duration"?
  • Sidenode: the node index of the last waypoint event and it's service event are different. Shouldn't they be equal?

Re: ETA at last Waypoint (xRoute2)

Posted: Fri Sep 06, 2024 8:03 am
by Yann Bartesch
Hi,
But what I don't get: Why is the last service event's "startsAt" given with a value BEFORE the arrival? Or is the definition of the last waypoint's event more like a "the last thing that happens on a route is the last waypoint" and therefore the "Arrival time" is supposed to be derived via "LastWaypoint.StartsAt - LastService.Duration"?
=> Yes, exactly ; the last WAYPOINT event is always the last event of the tour. If you want to know the arrival time, then you'll need to substract the service time.
Sidenode: the node index of the last waypoint event and it's service event are different. Shouldn't they be equal?
In your case, you may have specified an offRoadWaypoint. As the service is located before, it could happen that the index is the node on the road.

Re: ETA at last Waypoint (xRoute2)

Posted: Fri Sep 06, 2024 8:42 am
by Maximilian Vogel
As additional information:
  • Check also the technical concept on result lists. Although not explicitly written, you can see in the graphic that the last waypoint is the end of the route.
  • A service time produces a segment of type NOT_DRIVING. Therefore it is normal that the node index of the last service event and the node index of the last waypoint event do not match.
  • Keep in mind that there could also be tour events of type break, rest or waiting before the last service. So the arrival would then be before all tour events at the same location as the last waypoint. (Of course that depends on your interpretation of arrival.)
  • In PTV Developers Routing API the events are modeled differently. Waypoint and Schedule events will be present in the same event, but the schedule event is not necessarily of type SERVICE as there can be breaks, rests or waiting events upon arrival. Those will be contained in additional events. Likewise, the ETA given in the ETA response marks the time of arrival at the waypoint before any schedule events.

Re: ETA at last Waypoint (xRoute2)

Posted: Fri Sep 06, 2024 9:10 am
by Bernd Welter
Cool - I didn't know that the segments list shows NOT_DRIVING segments !

Thanks for your feedback, buddies ;-)

I wish you a nice weeken - I'll have a weekend in Nice ;-)