Page 1 of 1

How to apply PTV_TruckAttributes (xRoute2)

Posted: Mon Jun 27, 2022 9:25 am
by Bernd Welter
Quite often users approach us with an issue such as
I am calculating a route for a large truck but the route takes a path that is forbidden for this kind of vehicle - what are we doing wrong?
blue route: "wrong" route which uses a tunnel with a height restriction (2.60m). By applying the TruckAttributes properly the "correct" green route is returned.
blue route: "wrong" route which uses a tunnel with a height restriction (2.60m). By applying the TruckAttributes properly the "correct" green route is returned.
Well, the cause for this "experience" is quite simple - here's the xServer2 response:
To consider the so-called truck attributes data properly you need to provide two ingredients:
  • Proper releant attributes of the vehicle, either via a reference to a storedProfile (e.g. "truck40t") or through a requestProfile
  • Request the consideration of the additional data such as the PTV_TruckAttributes through a so-called feature layer theme.
The second part is often overseen and quite simple to be resolved. And of course you could also request several additional data sources at a time, e.g.
  • PTV_TruckAttributes
  • PTV_RestrictionZones
  • PTV_PreferredRoutes (and more)
Here's an overview of the available layers.

Here's a sample request:

Code: Select all

{
  "storedProfile":"truck40t",
  "requestProfile":{
    "featureLayerProfile":{
      "themes":[
        {
          "id":"PTV_TruckAttributes",
          "enabled":true          
        }
      ]
    }
  },
  "waypoints": [
    {
      "$type": "OffRoadWaypoint",
      "location": {
        "offRoadCoordinate": {
          "x": 8.3880776809,
          "y": 48.99174118
        }
      }
    },
    {
      "$type": "OffRoadWaypoint",
      "location": {
        "offRoadCoordinate": {
          "x": 8.377723763,
          "y": 48.98747636
        }
      }
    }
  ],
  "resultFields": {
    "polyline": true
  }
}