How to apply PTV_TruckAttributes (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: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

How to apply PTV_TruckAttributes (xRoute2)

Post 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
  }
}
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