Page 1 of 1

PTV_PreferredROutes: How to apply preferredRoutePenalty in routing

Posted: Thu Aug 31, 2023 9:40 am
by Bernd Welter
I've been asked for an example of how to apply the preferredRoutePenalty in a routing...
Segments in solid dark blue: attribute LOCAL_TRANSPORTATION<br /><br />dashed blue route: preferredRoutePenalty=0 (no special treatment)<br />dashed green route: preferredRoutePenalty=-75 (prefer such segments with a 75% &quot;bonus&quot;)
Segments in solid dark blue: attribute LOCAL_TRANSPORTATION

dashed blue route: preferredRoutePenalty=0 (no special treatment)
dashed green route: preferredRoutePenalty=-75 (prefer such segments with a 75% "bonus")
To consider this properly in amn xRoute2 route request you have to ensure to assign the following properties:
  • Request the feature layer theme PTV_PreferredRoutes
  • Choose the segment categories that you want to consider, e.g. "preferredRouteTypes=LOCAL_TRANSPORTATION"
  • Define the "strength of the preferencs" through preferredRoutePenalty, e.g. "preferredRoutePenalty=75"
Here's an extract of the request:

Code: Select all

{
  "waypoints": [
    {"location": { "coordinate": { "x": 8.8332500256,"y": 49.872730307 } },
    {"location": { "coordinate": { "x": 8.59845,"y": 49.803791 } }
  ],
  "requestProfile": {
    "vehicleProfile": {
      "preferredRouteTypes": "DE_LONG_TRUCK,LOCAL_TRANSPORTATION",
    },
    "featureLayerProfile": {
      "parameters": [
        {
          "key": "preferredRoutePenalty",
          "value": "-75"
        }
      ],
      "themes": [
        {
          "id": "PTV_PreferredRoutes",
          "enabled": true
        }
      ]
    }
  },
  "routeOptions": {
     ....
  },
  "resultFields": {
    ...
    },
  },
  "scope": "globalscope",
  "storedProfile": "truck40t"
}
Best regards,
Bernd

Re: PTV_PreferredROutes: How to apply preferredRoutePenalty in routing

Posted: Thu Aug 31, 2023 9:50 am
by Bernd Welter
Here's also an example about how to use the HAZARDOUS_TO_WATERS :
red segments: hazardousToWaters==1<br /><br />green route: vehicle without HAZARDOUS_TO_WATERS<br />blue detour: vehicle with HAZARSDOUS_TO WATERS
red segments: hazardousToWaters==1

green route: vehicle without HAZARDOUS_TO_WATERS
blue detour: vehicle with HAZARSDOUS_TO WATERS

Code: Select all

{
  "waypoints": [
    { "location" : { "coordinate": { "x": 8.393785 , "y": 49.077492 } } },
    { "location" : { "coordinate": { "x": 8.44454,    "y": 49.042198 } } }
  ],
  "routeOptions": {
...  },
  "resultFields": {
...
  },
  "requestProfile": {
    "vehicleProfile": {
      "load": {
        "hazardousGoodsTypes": "HAZARDOUS_TO_WATERS",
      }
    },
    "featureLayerProfile": {
      "themes": [
        {
          "id": "PTV_TruckAttributes",
          "enabled": true,
        }
      ]
    }
  },
  "scope": "globalscope",
  "storedProfile": "truck40t"
}