Truck restrictions

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
Rok
Posts: 13
Joined: Fri Nov 17, 2017 9:25 am

Truck restrictions

Post by Rok »

Greetings,

while using the PTV xServer .NET and testing the calculateExtendedRoute operation, I have encountered some unusual behavior concerning the restrictions on the route. It seems like some restrictions are not being considered.

I have two examples.

Example 1:
A bridge between the border of Hungary (Komárom) and Slovakia (Komárno). The bridge has two restrictions: max vehicle weight (20t) and max vehicle height (4.3m). If i use the PTV Map&Guide internet with the truck40t_02-00_M truck profile, the calculated route considers the restrictions and creates a path that bypasses the bridge (if I change the parameters GVWR <= 20t and vehicle height <= 4.3m, the calculated route now goes correctly across the bridge).
The problem occurs when I call the calculateExtendedRoute operation with my parameters. If I set the vehicle height to something above 4.3m the bridge height restriction is considered and the calculated route bypasses the bridge, however, if I set the weight to something above 20t, the restriction is not considered and the route still goes over the bridge.
Example XML request:

Code: Select all

<?xml version="1.0" encoding="utf-16"?>
<calculateExtendedRouteRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<ArrayOfWaypointDesc_1>
		<WaypointDesc fuzzyRadius="0" linkType="AUTO_LINKING" xmlns="http://xroute.xserver.ptvag.com">
			<wrappedCoords>
				<Point xmlns="http://common.xserver.ptvag.com">
					<kml xsi:nil="true" />
					<point x="18.118686676025391" y="47.742900848388672" />
				</Point>
			</wrappedCoords>
			<nodeID xsi:nil="true" />
			<wrappedRoutingOptions xsi:nil="true" />
			<wrappedSegmentID xsi:nil="true" />
			<wrappedVehicleOptions xsi:nil="true" />
			<viaType xsi:nil="true" />
		</WaypointDesc>
		<WaypointDesc fuzzyRadius="0" linkType="AUTO_LINKING" xmlns="http://xroute.xserver.ptvag.com">
			<wrappedCoords>
				<Point xmlns="http://common.xserver.ptvag.com">
					<kml xsi:nil="true" />
					<point x="18.129201889038086" y="47.762100219726563" />
				</Point>
			</wrappedCoords>
			<nodeID xsi:nil="true" />
			<wrappedRoutingOptions xsi:nil="true" />
			<wrappedSegmentID xsi:nil="true" />
			<wrappedVehicleOptions xsi:nil="true" />
			<viaType xsi:nil="true" />
		</WaypointDesc>
	</ArrayOfWaypointDesc_1>
	<ArrayOfRoutingOption_2>
		<RoutingOption parameter="COUNTRY_ENCODING" value="ISO2" xmlns="http://xroute.xserver.ptvag.com" />
		<RoutingOption parameter="OPTIMIZATION" value="90" xmlns="http://xroute.xserver.ptvag.com" />
		<RoutingOption parameter="SPEED_PROFILE" value="80,55,65,30,55,23,45,20,40,18,30,15,12,7,6,4" xmlns="http://xroute.xserver.ptvag.com" />
	</ArrayOfRoutingOption_2>
	<ArrayOfExceptionPath_3 xsi:nil="true" />
	<ResultListOptions_4 totalRectangle="false" tollManoeuvres="false" texts="false" segments="true" segmentAttributes="false" polygon="true" nodes="false" manoeuvreGroups="false" urbanManoeuvres="false" manoeuvreAttributes="false" dynamicInfo="false" detailLevel="ALL" brunnelManoeuvres="false" boundingRectanglesOffset="0" boundingRectanglesC="0" binaryPathDesc="true" manoeuvres="false">
		<cenEmissionConfiguration xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
		<destDetail xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
		<emissions emissionLevel="BASIC" xmlns="http://xroute.xserver.ptvag.com" />
		<hbefaType version="HBEFA_3_2" xmlns="http://xroute.xserver.ptvag.com" />
		<startDetail xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
	</ResultListOptions_4>
	<CountryInfoOptions_5 xmlns:q1="http://xroute.xserver.ptvag.com" xsi:type="q1:CountryInfoVehicleOptions" allEuro="true" calculatePartTollCosts="true" detailedTollCosts="true">
		<q1:wrappedReductionIDs xsi:nil="true" />
		<q1:wrappedTollScenarios xsi:nil="true" />
		<q1:wrappedOptions>
			<q1:VehicleOption parameter="TYPE" value="TRL" />
			<q1:VehicleOption parameter="LENGTH" value="1875" />
			<q1:VehicleOption parameter="WIDTH" value="255" />
			<q1:VehicleOption parameter="HEIGHT" value="400" />
			<q1:VehicleOption parameter="TOTAL_WEIGHT" value="40000" />
			<q1:VehicleOption parameter="TRAILER_WEIGHT" value="15000" />
			<q1:VehicleOption parameter="EMPTY_WEIGHT" value="15000" />
			<q1:VehicleOption parameter="LOAD_WEIGHT" value="21250" />
			<q1:VehicleOption parameter="AXLE_WEIGHT" value="11500" />
			<q1:VehicleOption parameter="NUMBER_OF_AXLES" value="5" />
			<q1:VehicleOption parameter="CYLINDER_CAPACITY" value="12000" />
			<q1:VehicleOption parameter="HEIGHT_ABOVE_FRONT_AXLE" value="400" />
			<q1:VehicleOption parameter="EMISSION_CLASS" value="EURO_5" />
			<q1:VehicleOption parameter="EMISSION_TECHNOLOGY" value="EGR" />
			<q1:VehicleOption parameter="FUEL_TYPE" value="DIESEL" />
			<q1:VehicleOption parameter="PARTICLE_FILTER_TYPE" value="NONE" />
		</q1:wrappedOptions>
	</CountryInfoOptions_5>
	<CallerContext_6>
		<wrappedProperties xmlns="http://baseservices.service.jabba.ptvag.com">
			<CallerContextProperty key="CoordFormat" value="OG_GEODECIMAL" />
			<CallerContextProperty key="ProfileXMLSnippet" value="<?xml version=\"1.0\" encoding=\"utf-8\"?><Profile xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><FeatureLayer majorVersion=\"1\" minorVersion=\"0\"><GlobalSettings enableTimeDependency=\"true\" /><Themes><Theme id=\"PTV_TruckAttributes\" enabled=\"true\" priorityLevel=\"0\" /><Theme id=\"PTV_RestrictionZones\" enabled=\"true\" priorityLevel=\"0\" /></Themes></FeatureLayer><Routing majorVersion=\"2\" minorVersion=\"1\"><Course><AdditionalDataRules enabled=\"true\" /></Course></Routing></Profile>" />
		</wrappedProperties>
	</CallerContext_6>
</calculateExtendedRouteRequest>

Example 2:
The road from Podkoren (Slovenia) to Tschau (Austria). The road is blocked for vehicles with a trailer. Once again, when using the PTV Map&Guide the restriction is considered and the calculated route goes around it, but when I call the operation, the restriction is once again not considered and the calculated route goes on the restricted road.
The XML request is basically the same, except for the WaypointDesc:

Code: Select all

<ArrayOfWaypointDesc_1>
	<WaypointDesc fuzzyRadius="0" linkType="AUTO_LINKING" xmlns="http://xroute.xserver.ptvag.com">
		<wrappedCoords>
			<Point xmlns="http://common.xserver.ptvag.com">
				<kml xsi:nil="true" />
				<point x="13.756142616271973" y="46.493747711181641" />
			</Point>
		</wrappedCoords>
		<nodeID xsi:nil="true" />
		<wrappedRoutingOptions xsi:nil="true" />
		<wrappedSegmentID xsi:nil="true" />
		<wrappedVehicleOptions xsi:nil="true" />
		<viaType xsi:nil="true" />
	</WaypointDesc>
	<WaypointDesc fuzzyRadius="0" linkType="AUTO_LINKING" xmlns="http://xroute.xserver.ptvag.com">
		<wrappedCoords>
			<Point xmlns="http://common.xserver.ptvag.com">
				<kml xsi:nil="true" />
				<point x="13.77748966217041" y="46.547710418701172" />
			</Point>
		</wrappedCoords>
		<nodeID xsi:nil="true" />
		<wrappedRoutingOptions xsi:nil="true" />
		<wrappedSegmentID xsi:nil="true" />
		<wrappedVehicleOptions xsi:nil="true" />
		<viaType xsi:nil="true" />
	</WaypointDesc>
</ArrayOfWaypointDesc_1>
I am including the PTV_TruckAttributes and PTV_RestrictionZones layers through ProfileXMLSnippet in the CallerContext property.

Any suggestion as to why the differences occur will be greatly appreciated. Thank you again in advance.


Best regards,
Rok
Joost
Posts: 310
Joined: Fri Apr 25, 2014 1:46 pm

Re: Truck restrictions

Post by Joost »

The VehicleOption in our API are deprecated and the newer featurelayer framework do not use them. I recommend to remove them and use the profile snippet mechanisme for setting up your vehicle properties. You are already using this mechanic for loading in the Truck Attributes, you just need to extend this with the Routing / Vehicle element.

Reference documentation:
https://xserver.ptvgroup.com/fileadmin/ ... ng_Vehicle

See also:
https://xserver.ptvgroup.com/fileadmin/ ... ibutes.htm
Joost Claessen
Senior Technical Consultant
PTV Benelux
Rok
Posts: 13
Joined: Fri Nov 17, 2017 9:25 am

Re: Truck restrictions

Post by Rok »

Hello Joost,

that was exactly the problem. Once I fixed the setting of the vehicle properties, all the restrictions are now considered. Thank you!
Rok
Posts: 13
Joined: Fri Nov 17, 2017 9:25 am

Re: Truck restrictions

Post by Rok »

Hello again,

after some more thorough testing, I've noticed that I am still getting some strange results.

For PTV Map&Guide calculations, I used the RF truck 40t (truck40t_02-00_M) profile.

Example 1:
Ljubljana (SLO) -> Villach (AUT)

PTV Map&Guide:
PTV_Ljubljana-Villach.PNG
Mine:
For some reason, the calculated route avoids the Karawanks Tunnel.
For some reason, the calculated route avoids the Karawanks Tunnel.
If I change the start point closer to the tunnel, then the route leads through it. Both of the calculated routes have 0 violations specified.
If I change the start point closer to the tunnel, then the route leads through it. Both of the calculated routes have 0 violations specified.

Example 2:
Kranjska gora (SLO) -> Riegersdorf (AUT)

I have used this example in the first post, I forgot to test it right after I changed the vehicle parameters.

PTV Map&Guide:
The calculated route avoids the road, which is the correct behaviour, because the road is blocked for vehicles with a trailer.
The calculated route avoids the road, which is the correct behaviour, because the road is blocked for vehicles with a trailer.
Mine:
Calculated route goes straight through the blocked road. No violations have been specified.
Calculated route goes straight through the blocked road. No violations have been specified.
My XML request (Ljubljana -> Villach)

Code: Select all

<?xml version="1.0" encoding="utf-16"?>
<calculateExtendedRouteRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<ArrayOfWaypointDesc_1>
		<WaypointDesc fuzzyRadius="0" linkType="AUTO_LINKING" xmlns="http://xroute.xserver.ptvag.com">
			<wrappedCoords>
				<Point xmlns="http://common.xserver.ptvag.com">
					<kml xsi:nil="true" />
					<point x="14.461441040039063" y="46.077518463134766" />
				</Point>
			</wrappedCoords>
			<nodeID xsi:nil="true" />
			<wrappedRoutingOptions xsi:nil="true" />
			<wrappedSegmentID xsi:nil="true" />
			<wrappedVehicleOptions xsi:nil="true" />
			<viaType xsi:nil="true" />
		</WaypointDesc>
		<WaypointDesc fuzzyRadius="0" linkType="AUTO_LINKING" xmlns="http://xroute.xserver.ptvag.com">
			<wrappedCoords>
				<Point xmlns="http://common.xserver.ptvag.com">
					<kml xsi:nil="true" />
					<point x="13.910551071166992" y="46.614376068115234" />
				</Point>
			</wrappedCoords>
			<nodeID xsi:nil="true" />
			<wrappedRoutingOptions xsi:nil="true" />
			<wrappedSegmentID xsi:nil="true" />
			<wrappedVehicleOptions xsi:nil="true" />
			<viaType xsi:nil="true" />
		</WaypointDesc>
	</ArrayOfWaypointDesc_1>
	<ArrayOfRoutingOption_2>
		<RoutingOption parameter="COUNTRY_ENCODING" value="ISO2" xmlns="http://xroute.xserver.ptvag.com" />
		<RoutingOption parameter="OPTIMIZATION" value="90" xmlns="http://xroute.xserver.ptvag.com" />
		<RoutingOption parameter="SPEED_PROFILE" value="80,55,65,30,55,23,45,20,40,18,30,15,12,7,6,4" xmlns="http://xroute.xserver.ptvag.com" />
		<RoutingOption parameter="REQUEST_VERSION" value="1.4.5" xmlns="http://xroute.xserver.ptvag.com" />
		<RoutingOption parameter="ALLOW_SEGMENT_VIOLATIONS" value="true" xmlns="http://xroute.xserver.ptvag.com" />
		<RoutingOption parameter="COST_OF_SEGMENT_VIOLATIONS" value="50000" xmlns="http://xroute.xserver.ptvag.com" />
	</ArrayOfRoutingOption_2>
	<ArrayOfExceptionPath_3 xsi:nil="true" />
	<ResultListOptions_4 totalRectangle="false" tollManoeuvres="false" texts="false" segments="true" segmentAttributes="false" polygon="true" nodes="false" manoeuvreGroups="false" urbanManoeuvres="false" manoeuvreAttributes="false" dynamicInfo="false" detailLevel="ALL" brunnelManoeuvres="false" boundingRectanglesOffset="0" boundingRectanglesC="0" binaryPathDesc="true" manoeuvres="false">
		<cenEmissionConfiguration xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
		<destDetail xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
		<emissions xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
		<hbefaType version="HBEFA_3_2" xmlns="http://xroute.xserver.ptvag.com" />
		<startDetail xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
	</ResultListOptions_4>
	<CountryInfoOptions_5 allEuro="true" calculatePartTollCosts="true" detailedTollCosts="true" tollDate="2018-01-15T13:24:59.3668847+01:00">
		<wrappedReductionIDs xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
		<wrappedTollScenarios xsi:nil="true" xmlns="http://xroute.xserver.ptvag.com" />
	</CountryInfoOptions_5>
	<CallerContext_6>
		<wrappedProperties xmlns="http://baseservices.service.jabba.ptvag.com">
			<CallerContextProperty key="CoordFormat" value="OG_GEODECIMAL" />
			<CallerContextProperty key="ProfileXMLSnippet" value="<?xml version=\"1.0\" encoding=\"utf-8\"?><Profile xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><FeatureLayer majorVersion=\"1\" minorVersion=\"0\"><GlobalSettings enableTimeDependency=\"true\" /><Themes><Theme id=\"PTV_GeneralTruckRestrictions\" enabled=\"true\" priorityLevel=\"0\" /><Theme id=\"PTV_TruckAttributes\" enabled=\"true\" priorityLevel=\"0\" /><Theme id=\"PTV_RestrictionZones\" enabled=\"true\" priorityLevel=\"0\" /></Themes></FeatureLayer><Routing majorVersion=\"2\" minorVersion=\"1\"><Course><AdditionalDataRules enabled=\"true\" /></Course><Vehicle><Physical><Drive><Emissions emissionTechnology=\"EXHAUST_GAS_RECIRCULATION\" /><Engine cylinderCapacity=\"12000\" /></Drive><Weight emptyWeight=\"10000\" totalPermittedWeight=\"40000\" loadWeight=\"21250\" /><Axle axleLoad=\"11500\" numberOfAxles=\"5\" /><Trailer emptyWeight=\"5000\" /><Dimension height=\"400\" heightAboveFrontAxle=\"400\" length=\"1875\" width=\"254\" /></Physical><Load loadType=\"GOODS\" /></Vehicle></Routing></Profile>" />
		</wrappedProperties>
	</CallerContext_6>
</calculateExtendedRouteRequest>
Once again, any info as to why the calculated routes differ will be appreciated. Thank you in advance.

Best regards,
Rok
Joost
Posts: 310
Joined: Fri Apr 25, 2014 1:46 pm

Re: Truck restrictions

Post by Joost »

Map and guide makes use of Here map data. After trying our your route I'm sure that you are using TomTom map data. This is where the difference is coming from. The both have their own truck attributes data and depending on if everything is correctly modeled that can give big impact on comparing the 2.

For example:
In you example route Here has not truck attributen on the way, while according to TomTom there is a transit ban on the highway near Jesenice ( to be precise: ban for motorized vehicles heavier then 7500 kg with exception for delivery ).
Joost Claessen
Senior Technical Consultant
PTV Benelux
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Truck restrictions

Post by Bernd Welter »

Here are some comparisons.
Close view to Karawankentunnel. Check the amount of TOMTOM data (left) and HERE (right). HERE seems so have more content.
Close view to Karawankentunnel. Check the amount of TOMTOM data (left) and HERE (right). HERE seems so have more content.
Larger scale... same conclusion
Larger scale... same conclusion
Other region
Other region
As Joost mentioned: maybe it's worth checking the blockings / attributes in detail.
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:
Rok
Posts: 13
Joined: Fri Nov 17, 2017 9:25 am

Re: Truck restrictions

Post by Rok »

Thank you both for the explanation, I suspected that it has something to do with the maps, but I didn't expect that the data between them differs so much. I've had some success with implementing this: http://devblog.ptvgroup.com/2014/01/10/ ... -vehicles/. I'll do some more tests and get back to you if I have any more questions.
Rok
Posts: 13
Joined: Fri Nov 17, 2017 9:25 am

Re: Truck restrictions

Post by Rok »

Hello again,

I have once again noticed some undesired behaviour when calculating routes, more specifically, calculating the toll costs. Whenever I calculated a route, the toll cost calculation was higher than expected and I narrowed the problem down to the emissionClass parameter.
I have followed Joost's suggestion with setting the vehicle properties through the snippet mechanism (followed the guide at: http://xserver.ptvgroup.com/de/cookbook ... -snippets/). The problem I have noticed is, that if I set a vehicle property (for example, the emissionClass property) to its default value (EURO_5), once I call the .ToSnippet() function, that value gets "lost" and the resulting xml has no emissionClass attribute at Routing/Vehicle/Physical/Drive/Emissions.

Example of the resulting XML after the .ToSnippet() call, when setting the emissionClass to EURO_5:

Code: Select all

<Vehicle>
	<Physical>
		<Drive>
			<Emissions emissionTechnology="EXHAUST_GAS_RECIRCULATION" />
			<Engine cylinderCapacity="12000" />
		</Drive>
		<Weight emptyWeight="10000" totalPermittedWeight="40000" loadWeight="21250" />
		<Axle axleLoad="11500" numberOfAxles="5" />
		<Trailer emptyWeight="5000" />
		<Dimension height="400" heightAboveFrontAxle="400" length="1875" width="254" />
	</Physical>
	<Load loadType="GOODS" />
</Vehicle>
Example of the resulting XML after the .ToSnippet() call, when setting the emissionClass to EURO_4:

Code: Select all

<Vehicle>
	<Physical>
		<Drive>
			<Emissions emissionTechnology="EXHAUST_GAS_RECIRCULATION" emissionClass="EURO_4" />
			<Engine cylinderCapacity="12000" />
		</Drive>
		<Weight emptyWeight="10000" totalPermittedWeight="40000" loadWeight="21250" />
		<Axle axleLoad="11500" numberOfAxles="5" />
		<Trailer emptyWeight="5000" />
		<Dimension height="400" heightAboveFrontAxle="400" length="1875" width="254" />
	</Physical>
	<Load loadType="GOODS" />
</Vehicle>
I figured that when this happens, the route calculation considers the default value (EURO_5), but once I checked the results, that didn't seem to be the case and that's why I consistently got higher toll prices on all the toll segments.

Another example is when calculating emissions. When setting the emissionsLevel to BASIC in the resultListOptions and afterwards making a request for route calculation, I get an error: "The vehicle profile for emission calculation is invalid or incomplete: TRUCK: only fuel type DIESEL is supported". Even though I am explicitly setting the fuelType to DIESEL in my profile, but it once again seems to get lost after the .ToSnippet() call.

Am i configuring all the properties correctly, or am I perhaps doing this the wrong way?

Thank you again in advance for the help.


Best regards,
Rok
User avatar
Oliver Heilig
Posts: 160
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Truck restrictions

Post by Oliver Heilig »

Hi Rok,

this seems to be a problem with the xsd.exe tool in combination with the XmlSerializer class. xsd.exe creates the property with a DefaultValueAttribute set to EURO_5, and the XmlSerializer doesn't write a value if it's equal to the default value. A workaround for this issue is to remove the DefaultValueAttribute from the generated code:

Code: Select all

    [System.Xml.Serialization.XmlAttributeAttribute()]
//  [System.ComponentModel.DefaultValueAttribute(EmissionClass.EURO_5)]
    public EmissionClass emissionClass {
        get { ...
There's a stackoverflow discussion about this issue, i haven't found a better solution.

https://stackoverflow.com/questions/238 ... attributes

Oli
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
Rok
Posts: 13
Joined: Fri Nov 17, 2017 9:25 am

Re: Truck restrictions

Post by Rok »

Hello Oli,

thank you for the solution, albeit a bit ugly, but nonetheless it works. I commented out the DefaultValueAttributes for the values that I am certain will be set and the calculations look correct now.

Best regards,
Rok
Post Reply