I've been asked how to enforce a vehicle to performa a detour around streets with the feature "driveType=0|hasTrailer=1:PTV_TruckAttributes()" which means "forbidden for trucks with a trailer".
Here's a snippet that demonstrates what you have to do:
- Activate TruckAttributes (line 7)
- Tell the engine that you weant to consider AdditionalData and Vehicle specific segment info (line 20,21)
- Tell the engine how much you dislike the segments which are forbidden for trailers (line24)
- Tell the engine your trailer weighs more than 0 (line30)
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Profile>
<Common coordinateFormat="OG_GEODECIMAL" language="en" majorVersion="1" minorVersion="0"/>
<FeatureLayer majorVersion="1" minorVersion="0">
<GlobalSettings enableTimeDependency="false" enableVehicleDependency="true"/>
<Themes>
<Theme id="PTV_TruckAttributes" enabled="true" priorityLevel="0"/>
</Themes>
</FeatureLayer>
<Routing majorVersion="2" minorVersion="0">
<Waypoint linkType="ROAD" maximumDistanceToCombinedTransport="100" maximumDistanceToSegment="1000">
<LinkTypeConfiguration>
<Road headingTolerance="360" maximumDistanceForNetworkClass0="1000" maximumNetworkClass="7" minimumNetworkClass="0" onlyReachableRoads="true"/>
<Smart checkNetworkClassOnlyForVias="true" maximumDistanceToMainNode="100" maximumDistanceToMainNodeForNetworkClass0="1500"/>
<TollStation maximumDistance="1000"/>
<RoadName maximumDistance="3000" maximumDistanceToMainNode="2000"/>
</LinkTypeConfiguration>
</Waypoint>
<Course distanceTimeWeighting="80" enforceShortestRoute="false">
<AdditionalDataRules enabled="true" layerName="">
<VehicleSpecific enabled="true">
<Malus combustibles="0" delivery="0" hazardousGoods="0" hazardousToWaters="0"
maintenanceTrucks="0" preferredForHazardousGoods="0" preferredForTrucks="0"
residential="0" restrictedTunnel="0" vehiclesWithTrailer="0"/>
</VehicleSpecific>
</AdditionalDataRules>
</Course>
<Vehicle>
<Physical>
<Trailer emptyWeight="1"/>
</Physical>
</Vehicle>
</Routing>
</Profile>