servicePeriod ignored in time total when calculateRoute

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
Nicolas Humblot
Posts: 1
Joined: Mon Apr 16, 2018 4:09 pm

servicePeriod ignored in time total when calculateRoute

Post by Nicolas Humblot »

Hello,

I would like to calculate a route with multiple way points in it, each point having a pause time when reached.

To express this pause time, I've seen in the documentation the "servicePeriod" field, in the "TourPointDesc" class. I know there is an identical field name when contacting the xTour.planBasicTours() method which works nicely when I tested it.

Unfortunately, I can't make it work when using xRoute.calculateRoute(). I defined the type of my way points to "TourPointDesc" and added the "servicePeriod" value for each point.

I came up with this JSON body when contacting xRoute.calculateRoute() :

Code: Select all

{  
   "waypoints":[  
      {  
         "linkType":"NEXT_SEGMENT",
				 "$type" : "TourPointDesc",
				 "servicePeriod": 3600,
         "coords":[  
            {  
               "point":{
                  "x":-0.6446577,
                  "y":44.840727
               }
            }
         ]
      },
      {  
         "linkType":"NEXT_SEGMENT",
				 "$type" : "TourPointDesc",
				 "servicePeriod": 3600,
				 "useServicePeriodForRecreation": false,
				 "completeServiceInIntervals": true,
         "coords":[  
            {  
               "point":{
                  "x":2.2828813,
                  "y":48.82943
               }
            }
         ]
      },
		 {  
         "linkType":"NEXT_SEGMENT",
			   "$type" : "TourPointDesc",
			   "servicePeriod" : 3600,
         "coords":[  
            {  
               "point":{
                  "x":-0.6446577,
                  "y":44.840727
               }
            }
         ]
      }
   ],
   "options": null,
   "exceptionPaths":null,
   "details":{},
   "callerContext":{  
      "properties":[  
         {
            "key":"CoordFormat",
            "value":"OG_GEODECIMAL"
         }
      ]
   }
}
The PTV Server response is :

Code: Select all

{
	"info": {
		"distance": 1157801,
		"time": 37176,
		"cost": 531286,
		"hasViolations": false
	},
	"stations": [
		{
			"$type": "WayPoint",
			"accTime": 0,
			"accDist": 0,
			"iuCode": 33,
			"polyIdx": 0,
			"nodeIdx": 0,
			"segmentIdx": 0,
			"manoeuvreIdx": -1,
			"locationCoord": {
				"$type": "Point",
				"point": {
					"$type": "PlainPoint",
					"x": -0.64469578361,
					"y": 44.84071499
				}
			},
			"matchCoord": {
				"$type": "Point",
				"point": {
					"$type": "PlainPoint",
					"x": -0.64483222106,
					"y": 44.840324819
				}
			},
			"wayPointType": "START",
			"countryCode": ""
		},
		{
			"$type": "WayPoint",
			"accTime": 18920,
			"accDist": 570112,
			"iuCode": 33,
			"polyIdx": 3545,
			"nodeIdx": 2910,
			"segmentIdx": 2049,
			"manoeuvreIdx": 0,
			"locationCoord": {
				"$type": "Point",
				"point": {
					"$type": "PlainPoint",
					"x": 2.2828578219,
					"y": 48.829414984
				}
			},
			"matchCoord": {
				"$type": "Point",
				"point": {
					"$type": "PlainPoint",
					"x": 2.2831254349,
					"y": 48.829262297
				}
			},
			"wayPointType": "VIA",
			"countryCode": ""
		},
		{
			"$type": "WayPoint",
			"accTime": 37166,
			"accDist": 1157707,
			"iuCode": 33,
			"polyIdx": 6844,
			"nodeIdx": 5534,
			"segmentIdx": 3788,
			"manoeuvreIdx": -1,
			"locationCoord": {
				"$type": "Point",
				"point": {
					"$type": "PlainPoint",
					"x": -0.64469578361,
					"y": 44.84071499
				}
			},
			"matchCoord": {
				"$type": "Point",
				"point": {
					"$type": "PlainPoint",
					"x": -0.64483222106,
					"y": 44.840324819
				}
			},
			"wayPointType": "DEST",
			"countryCode": ""
		}
	]
}
When looking at the result, the "info.time" field value never changes, even if I remove the "servicePeriod" fields or set them to 0.

When contacting the xTour.planBasicTours() method, I can clearly see these servicePeriods being added to the estimated time.

Could someone tell me what I am missing please ?
Thank you very much for your help.
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: servicePeriod ignored in time total when calculateRoute

Post by Bernd Welter »

Hello Nicolas,

looks like my subscription failed (haven't noticed your post). Sorry for that.

The xRoute offers some extended methods such as calculateTour and calculateAdvancedTour.
Those methods should consider the additional properties of a TourpointDesc.

The other methods calculateRouteInfo, calculateRoute and calculateExtendedRoute treat the TourpointDesc as regular WaypointDesc (thats the base class of TourpointDesc) and do not consider the timeslots and service periods.

I think this should answer the question. If not: get back!!

C u
Bernd
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