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:

PTV_PreferredRoutes.PNG
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 https://xroute-tln-eu-n-test.cloud.ptvgroup.com/ 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="http://www.ptv.de/com/ptvag/xserver/engines/xpoidbaccess">
<FeatureLayer majorVersion='1' minorVersion='0'>
<GlobalSettings>
<Parameter name="preferredRouteBonus" value="-10"></Parameter>
</GlobalSettings>
<Themes>
<Theme id='PTV_PreferredRoutes' enabled='true'>
<PropertyValue id="preferredRouteType" value="18"></PropertyValue>
</Theme>
</Themes>
</FeatureLayer>
<Routing majorVersion="2" minorVersion="0">
<Course>
<AdditionalDataRules enabled='true'/>
</Course>
</Routing>
</Profile>

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

cron