PTV_PreferredROutes: How to apply preferredRoutePenalty in routing

Deals with generic topics such as logging, framework and so on. If you are not sure where to place your topic just put it here.
Post Reply
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

PTV_PreferredROutes: How to apply preferredRoutePenalty in routing

Post 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
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:
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: PTV_PreferredROutes: How to apply preferredRoutePenalty in routing

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