Linking / Driving time between two waypoints

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
jasci01
Posts: 7
Joined: Mon Feb 12, 2018 3:49 pm

Linking / Driving time between two waypoints

Post by jasci01 »

Hi all,

I'm currently testing around with calculateAdvancedTour. I Need to use this as I need both toll Information and regarding driving regulations. Currently, XServer is not reachable, I will provide examples as soon as I can.

Key question: How can I notice and handle additional time and distance for linking ?

Input: a list of 4 waypoints. One of them is a Point I chose from a map, so it is not connected exactly to a road.
Targeted result: List of waypoints, with driving distance and time from each Point to the next.

In the Response, I now see several Information, but I am struggling in putting them all together.

- Route-info-distance contains the overall time and distance including linking.
- the array of tour events shows a timestmap of start and end as well as the period, which seems to include linking as well
- the array of stations contains accumulated distance and time, with time meaning from tour start to Arrival, without linking, breaks, Service, ...

I started doing the maths:
Distance from Station A to B = ACC_DIST of Station B - ACC_DIST of Station A --> 33638m
Driving time from Station A to B = ACC_TIME of Station B - ACC_TIME of Station A - Service period --> 3232 sec

Doing this for the whole tour, I ended up in this table:
StationACC_TIMEACC_DISTService perioddist from prevtime from prev
A00000
B3232336381000336383232
C7747746961600410583515
D13822144388200696924475
SUM280014438811222
Total driving time including Service from tour start to the very end (end of service) is then 14.022 sec, and total distance is 144.388 m.
Comparing my results (sums) to values of Route-Info, I recognized it gives time="14102" and distance="145188" There is a difference of 800m / 80sec. This may seem as a very tiny difference, but nevertheless, as my tours can have a lot of stations, the error keeps growing bigger with each one added.
I only found in the tour events that driving from Point A to B lasts 3272sec and not 3232sec as I calculated, and from C to D it is 4515sec instead of 4475 seconds.
By the way, in the Country Infos, while distance="144388" which is equal to my calculations, but time="13822" , which is the third possible value...


This leads me to the following questions:

- How can I recognize if a linking distance and time has been added to the stations? The only way seems to compare sum with the header Information
- Does the ACC_* values in the waypoint array also include the linking?
- Does the toll distance also include possible linking differences?

Here's the request:

Code: Select all

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
	<soap-env:Header>
		<n0:CallerInformation xmlns:n0="http://www.sap.com/webas/712/soap/features/runtime/metering/">
			<m:Type xmlns:m="http://www.sap.com/webas/712/soap/features/runtime/metering/">SA</m:Type>
			<m:Company xmlns:m="http://www.sap.com/webas/712/soap/features/runtime/metering/">0020630452</m:Company>
			<m:Sys xmlns:m="http://www.sap.com/webas/712/soap/features/runtime/metering/">XH1_200</m:Sys>
		</n0:CallerInformation>
	</soap-env:Header>
	<soap-env:Body>
		<n1:calculateAdvancedTour xmlns:n1="http://types.xroute.xserver.ptvag.com" xmlns:prx="urn:sap.com:proxy:XH1:/1SAI/TAEF77083FD8061B8ACA5BE:740">
			<n1:ArrayOfWaypointDesc_1>
				<n2:WaypointDesc xsi:type="n2:TourPointDesc" completeServiceInIntervals="true" fuzzyRadius="0" linkType="NEXT_SEGMENT" xmlns:n2="http://xroute.xserver.ptvag.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
					<n2:wrappedCoords>
						<n3:Point xmlns:n3="http://common.xserver.ptvag.com">
							<n3:point x="9.6128079999999994E0" y="4.9860455000000002E1"/>
						</n3:Point>
					</n2:wrappedCoords>
				</n2:WaypointDesc>
				<n2:WaypointDesc xsi:type="n2:TourPointDesc" completeServiceInIntervals="true" servicePeriod="1000" fuzzyRadius="0" linkType="NEXT_SEGMENT" xmlns:n2="http://xroute.xserver.ptvag.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
					<n2:wrappedCoords>
						<n3:Point xmlns:n3="http://common.xserver.ptvag.com">
							<n3:point x="9.9420249999999992E0" y="4.9787083000000003E1"/>
						</n3:Point>
					</n2:wrappedCoords>
				</n2:WaypointDesc>
				<n2:WaypointDesc xsi:type="n2:TourPointDesc" completeServiceInIntervals="true" servicePeriod="1600" fuzzyRadius="0" linkType="NEXT_SEGMENT" xmlns:n2="http://xroute.xserver.ptvag.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
					<n2:wrappedCoords>
						<n3:Point xmlns:n3="http://common.xserver.ptvag.com">
							<n3:point x="9.7799750000000003E0" y="4.9490901999999998E1"/>
						</n3:Point>
					</n2:wrappedCoords>
				</n2:WaypointDesc>
				<n2:WaypointDesc xsi:type="n2:TourPointDesc" completeServiceInIntervals="true" servicePeriod="200" fuzzyRadius="0" linkType="NEXT_SEGMENT" xmlns:n2="http://xroute.xserver.ptvag.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
					<n2:wrappedCoords>
						<n3:Point xmlns:n3="http://common.xserver.ptvag.com">
							<n3:point x="9.6128079999999994E0" y="4.9860455000000002E1"/>
						</n3:Point>
					</n2:wrappedCoords>
				</n2:WaypointDesc>
			</n1:ArrayOfWaypointDesc_1>
			<n1:TourOptions_2 restrictToSingleOperatingInterval="false"/>
			<n1:ArrayOfRoutingOption_3 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
			<n1:ArrayOfExceptionPath_4 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
			<n1:ResultListOptions_5 binaryPathDesc="false" boundingRectanglesC="0" boundingRectanglesOffset="0" brunnelManoeuvres="false" detailLevel="STANDARD" dynamicInfo="false" manoeuvreAttributes="false" manoeuvreGroups="false" manoeuvres="false" nodes="false" polygon="false" segmentAttributes="false" segments="false" texts="false" tollManoeuvres="false" totalRectangle="false" urbanManoeuvres="false"/>
			<n1:CountryInfoOptions_6 allEuro="false" calculatePartTollCosts="true" detailedTollCosts="false"/>
			<n1:CallerContext_7>
				<n4:wrappedProperties xmlns:n4="http://baseservices.service.jabba.ptvag.com">
					<n4:CallerContextProperty key="CoordFormat" value="OG_GEODECIMAL"/>
					<n4:CallerContextProperty key="ResponseGeometry" value="PLAIN"/>
					<n4:CallerContextProperty key="Profile" value="truckfast"/>
				</n4:wrappedProperties>
			</n1:CallerContext_7>
		</n1:calculateAdvancedTour>
	</soap-env:Body>
</soap-env:Envelope>
and the response:

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<ns4:calculateAdvancedTourResponse xmlns:ns6="http://exception.core.jabba.ptvag.com" xmlns:ns2="http://baseservices.service.jabba.ptvag.com" xmlns:ns4="http://types.xroute.xserver.ptvag.com" xmlns:ns3="http://xroute.xserver.ptvag.com" xmlns:ns1="http://common.xserver.ptvag.com" xmlns:ns0="http://wrappertypes.service.jabba.ptvag.com">
			<ns4:result genuineWaitingPeriod="0" defermentPotential="2147483647" remainingPeriods="22 serialization::archive 9 0 2 0 0 1 4 0 4 0 0 0 0 4898 0 0 0 0 11302 0 14102 152229 0 0 3 2147483647 2147483647 2147483647 0 0 0 0 14102 0 0 0 11302 152229 0 11302 152229 0 11302 757029 0 0 6 0 0 0 138127 0 0 0 0 0 0 0 0 0 3 0 0 1522174629 2147483647 0 1522174629 0 0 0 4 0 0 0 0 0 0 0 2 0 0 2 0 0 0 0 0 4 0 0 0 0 4 0 0 0 0 0 6 1 16200 900 1800 1 39600 10800 32400 32400 3 32400 36000 2 604800 86400 1 518400 201600 162000 324000 345600 0 1800 2700 21600 32400 900 28800 172800 39600 0 0 0 0 0 0 0 0 0 0 900 19800 28800 39600 0 25200 86400 43200 0 86400 604800 259200 900" tourPeriod="14102" startTime="2018-03-27T14:22:07Z" isViolated="false">
				<ns3:wrappedCountryInfos>
					<ns3:CountryInfo additionalInfo="" countryCode="" currency="EUR" iuCode="49">
						<ns3:partRouteInfo cost="47292" time="13822" distance="144388"/>
						<ns3:wrappedPerNCRouteInfo>
							<ns3:RouteInfo cost="45717" time="2153" distance="45717"/>
							<ns3:RouteInfo cost="0" time="0" distance="0"/>
							<ns3:RouteInfo cost="1575" time="8600" distance="88297"/>
							<ns3:RouteInfo cost="0" time="2371" distance="6007"/>
							<ns3:RouteInfo cost="0" time="473" distance="2967"/>
							<ns3:RouteInfo cost="0" time="225" distance="1400"/>
							<ns3:RouteInfo cost="0" time="0" distance="0"/>
							<ns3:RouteInfo cost="0" time="0" distance="0"/>
						</ns3:wrappedPerNCRouteInfo>
						<ns3:wrappedPerTypeTollDistance>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>47600</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
						</ns3:wrappedPerTypeTollDistance>
						<ns3:wrappedPerTypeTollPrice>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>638</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
							<ns0:Int>0</ns0:Int>
						</ns3:wrappedPerTypeTollPrice>
						<ns3:wrappedTollCostInfos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
					</ns3:CountryInfo>
				</ns3:wrappedCountryInfos>
				<ns3:wrappedPartTollCosts>
					<ns3:PartTollCosts distance="0">
						<ns3:wrappedCosts/>
					</ns3:PartTollCosts>
					<ns3:PartTollCosts distance="1800">
						<ns3:wrappedCosts>
							<ns3:TollCost type="NATIONALTOLL" iuCode="49" currency="EUR" cost="24"/>
						</ns3:wrappedCosts>
					</ns3:PartTollCosts>
					<ns3:PartTollCosts distance="45800">
						<ns3:wrappedCosts>
							<ns3:TollCost type="NATIONALTOLL" iuCode="49" currency="EUR" cost="614"/>
						</ns3:wrappedCosts>
					</ns3:PartTollCosts>
				</ns3:wrappedPartTollCosts>
				<ns3:route>
					<ns3:wrappedBoundingRectangles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
					<ns3:info cost="121421" time="14102" distance="145188"/>
					<ns3:wrappedManoeuvreGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
					<ns3:wrappedManoeuvres xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
					<ns3:wrappedNodes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
					<ns3:wrappedSegments xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
					<ns3:wrappedStations>
						<ns3:WayPoint countryCode="" wayPointType="START" manoeuvreIdx="0" segmentIdx="0" nodeIdx="0" polyIdx="0" iuCode="49" accDist="0" accTime="0">
							<ns3:locationCoord>
								<ns1:point y="49.860429025" x="9.6127714168"/>
							</ns3:locationCoord>
							<ns3:matchCoord>
								<ns1:point y="49.856859832" x="9.6129444298"/>
							</ns3:matchCoord>
						</ns3:WayPoint>
						<ns3:WayPoint countryCode="" wayPointType="VIA" manoeuvreIdx="11" segmentIdx="283" nodeIdx="331" polyIdx="428" iuCode="49" accDist="33638" accTime="3232">
							<ns3:locationCoord>
								<ns1:point y="49.787068238" x="9.9420152269"/>
							</ns3:locationCoord>
							<ns3:matchCoord>
								<ns1:point y="49.7870345" x="9.9421436108"/>
							</ns3:matchCoord>
						</ns3:WayPoint>
						<ns3:WayPoint countryCode="" wayPointType="VIA" manoeuvreIdx="13" segmentIdx="589" nodeIdx="702" polyIdx="904" iuCode="49" accDist="74696" accTime="7747">
							<ns3:locationCoord>
								<ns1:point y="49.490882383" x="9.7799452642"/>
							</ns3:locationCoord>
							<ns3:matchCoord>
								<ns1:point y="49.49096722" x="9.7799338084"/>
							</ns3:matchCoord>
						</ns3:WayPoint>
						<ns3:WayPoint countryCode="" wayPointType="DEST" manoeuvreIdx="26" segmentIdx="1041" nodeIdx="1267" polyIdx="1604" iuCode="49" accDist="144388" accTime="13822">
							<ns3:locationCoord>
								<ns1:point y="49.860429025" x="9.6127714168"/>
							</ns3:locationCoord>
							<ns3:matchCoord>
								<ns1:point y="49.856859832" x="9.6129444298"/>
							</ns3:matchCoord>
						</ns3:WayPoint>
					</ns3:wrappedStations>
					<ns3:wrappedTexts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
				</ns3:route>
				<ns3:recreationPeriods weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
				<ns3:wrappedTourEvents>
					<ns3:TourEvent segmentIndex="0" period="0" startTime="2018-03-27T14:22:07Z" tourPointIndex="0">
						<ns3:wrappedDescriptions>
							<ns0:String>SERVICE</ns0:String>
							<ns0:String>IS_IN_SERVICE_INTERVAL</ns0:String>
						</ns3:wrappedDescriptions>
						<ns3:wrappedViolations/>
					</ns3:TourEvent>
					<ns3:TourEvent segmentIndex="0" period="3272" startTime="2018-03-27T14:22:07Z" tourPointIndex="-1">
						<ns3:wrappedDescriptions>
							<ns0:String>DRIVING</ns0:String>
						</ns3:wrappedDescriptions>
						<ns3:wrappedViolations/>
					</ns3:TourEvent>
					<ns3:TourEvent segmentIndex="283" period="1000" startTime="2018-03-27T15:16:39Z" tourPointIndex="1">
						<ns3:wrappedDescriptions>
							<ns0:String>SERVICE</ns0:String>
							<ns0:String>IS_IN_SERVICE_INTERVAL</ns0:String>
						</ns3:wrappedDescriptions>
						<ns3:wrappedViolations/>
					</ns3:TourEvent>
					<ns3:TourEvent segmentIndex="285" period="3515" startTime="2018-03-27T15:33:19Z" tourPointIndex="-1">
						<ns3:wrappedDescriptions>
							<ns0:String>DRIVING</ns0:String>
						</ns3:wrappedDescriptions>
						<ns3:wrappedViolations/>
					</ns3:TourEvent>
					<ns3:TourEvent segmentIndex="589" period="1600" startTime="2018-03-27T16:31:54Z" tourPointIndex="2">
						<ns3:wrappedDescriptions>
							<ns0:String>SERVICE</ns0:String>
							<ns0:String>IS_IN_SERVICE_INTERVAL</ns0:String>
						</ns3:wrappedDescriptions>
						<ns3:wrappedViolations/>
					</ns3:TourEvent>
					<ns3:TourEvent segmentIndex="595" period="4515" startTime="2018-03-27T16:58:34Z" tourPointIndex="-1">
						<ns3:wrappedDescriptions>
							<ns0:String>DRIVING</ns0:String>
						</ns3:wrappedDescriptions>
						<ns3:wrappedViolations/>
					</ns3:TourEvent>
					<ns3:TourEvent segmentIndex="1041" period="200" startTime="2018-03-27T18:13:49Z" tourPointIndex="3">
						<ns3:wrappedDescriptions>
							<ns0:String>SERVICE</ns0:String>
							<ns0:String>IS_IN_SERVICE_INTERVAL</ns0:String>
						</ns3:wrappedDescriptions>
						<ns3:wrappedViolations/>
					</ns3:TourEvent>
				</ns3:wrappedTourEvents>
				<ns3:wrappedTourPointResults>
					<ns3:TourPointResult stationIndex="0" genuineWaitingPeriod="0" departureTime="2018-03-27T14:22:07Z" endServiceTime="2018-03-27T14:22:07Z" startServiceTime="2018-03-27T14:22:07Z" arrivalTime="2018-03-27T14:22:07Z">
						<ns3:recreationPeriodsAtTourPoint weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
						<ns3:recreationPeriodsOnRoad weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
					</ns3:TourPointResult>
					<ns3:TourPointResult stationIndex="1" genuineWaitingPeriod="0" departureTime="2018-03-27T15:33:19Z" endServiceTime="2018-03-27T15:33:19Z" startServiceTime="2018-03-27T15:16:39Z" arrivalTime="2018-03-27T15:16:39Z">
						<ns3:recreationPeriodsAtTourPoint weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
						<ns3:recreationPeriodsOnRoad weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
					</ns3:TourPointResult>
					<ns3:TourPointResult stationIndex="2" genuineWaitingPeriod="0" departureTime="2018-03-27T16:58:34Z" endServiceTime="2018-03-27T16:58:34Z" startServiceTime="2018-03-27T16:31:54Z" arrivalTime="2018-03-27T16:31:54Z">
						<ns3:recreationPeriodsAtTourPoint weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
						<ns3:recreationPeriodsOnRoad weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
					</ns3:TourPointResult>
					<ns3:TourPointResult stationIndex="3" genuineWaitingPeriod="0" departureTime="2018-03-27T18:17:09Z" endServiceTime="2018-03-27T18:17:09Z" startServiceTime="2018-03-27T18:13:49Z" arrivalTime="2018-03-27T18:13:49Z">
						<ns3:recreationPeriodsAtTourPoint weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
						<ns3:recreationPeriodsOnRoad weeklyRestPeriod="0" dailyRestPeriod="0" breakPeriod="0"/>
					</ns3:TourPointResult>
				</ns3:wrappedTourPointResults>
			</ns4:result>
		</ns4:calculateAdvancedTourResponse>
	</soap:Body>
</soap:Envelope>
jasci01
Posts: 7
Joined: Mon Feb 12, 2018 3:49 pm

Re: Linking / Driving time between two waypoints

Post by jasci01 »

Problem solved. :lol:

"By accident", I came accross a Routing Option called "GENERATE_EXTWAYPOINTS". If set, this Returns linking distance and -time within the waypoint array.
Post Reply