How to consider "Truck With Trailer" restriction (xs1)?

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

How to consider "Truck With Trailer" restriction (xs1)?

Post by Bernd Welter »

Cheers,

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>
Attachments
TruckWithTrailer.PNG
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