ETA at last Waypoint (xRoute2)

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
Post Reply
User avatar
Bernd Welter
Site Admin
Posts: 2703
Joined: Mon Apr 14, 2014 10:28 am
Contact:

ETA at last Waypoint (xRoute2)

Post 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?
Attachments
Screenshot 2024-09-05 183730.png
Screenshot 2024-09-05 183730.png (10.62 KiB) Viewed 1284 times
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Yann Bartesch
Posts: 1
Joined: Fri Jan 21, 2022 7:47 am

Re: ETA at last Waypoint (xRoute2)

Post 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.
Yann Bartesch
Developer
PTV Logistics
Maximilian Vogel
Posts: 16
Joined: Fri Dec 29, 2017 9:00 am

Re: ETA at last Waypoint (xRoute2)

Post 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.
Maximilian Vogel
Developer
PTV Logistics
User avatar
Bernd Welter
Site Admin
Posts: 2703
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: ETA at last Waypoint (xRoute2)

Post 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 ;-)
Attachments
XRouteToll2 test
XRouteToll2 test
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply