SampleSnippet PTV_PreferredRoutes

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.

SampleSnippet PTV_PreferredRoutes

Postby Bernd Welter » Mon Sep 30, 2019 1:54 pm

Hi there,

just for those who look or a sample snippet ready to be used with PTV_PreferredRoutes:

Feature Layer PTV_PreferredRoutes is activated on the route in the right map. Therefore the inner city of munich is bypassed. As the red segments are getting a negative malus (causes preference handling) the costs of the right route is cheaper than without the layer. I used for the comparison. Also important: The area of Munich is covered by PreferredRouteType=18. Other regions could use other types.

Be aware that PTV_PreferredRoutes is available only for some maps.
xml code
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Profile parent="truckfast" xmlns:ns2="">
<FeatureLayer majorVersion='1' minorVersion='0'>
<Parameter name="preferredRouteBonus" value="-10"></Parameter>
<Theme id='PTV_PreferredRoutes' enabled='true'>
<PropertyValue id="preferredRouteType" value="18"></PropertyValue>
<Routing majorVersion="2" minorVersion="0">
<AdditionalDataRules enabled='true'/>

The preferredRouteBonus is a regular malus value:

  • negative values between -99 and -1 will decrease the virtual costs of the corresponding route segments which causes them to be more attractive
  • We can't give a definitive recommendation for the value that fits your requirements best - that's something you have to play with ;-)
  • The preferredRouteType describes the character of a segment, e.g. category 18 means "Local route network that is designated for trucks with an origin and destination within a borough."

Best regards,
Bernd Welter
Senior Technical Consultant Developer Components
PTV GROUP - Germany

Bernd at Youtube
User avatar
Bernd Welter
Site Admin
Posts: 1395
Joined: Mon Apr 14, 2014 10:28 am

Return to PTV xRouteServer