Route calculation and PTV_TruckAttributes

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
fstrahberger
Posts: 9
Joined: Fri Mar 09, 2018 2:17 pm

Route calculation and PTV_TruckAttributes

Post by fstrahberger »

Hello,
I have a question about routing with PTV_TruckAttributes enabled. When this feature is enabled then all truck features are considered as blocking even when the vehicle does not violate the restrictions.

So I tried the example from the manuals. The example request is based on the Routing Use Case „How to Use Feature Layer Theme PTV_TruckAttributes“.

The manual states that the route for a vehicle with maxHeight=150 will be routed through a height (460 cm) restricted area. The route should be about 800 meters.

Here ist he JSON-Request:

Code: Select all

{
  "waypoints": [
    {
      "$type": "WaypointDesc",
      "linkType": "NEXT_SEGMENT",
      "fuzzyRadius": 0,
      "coords": [
        {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 5.995894,
            "y": 49.510518
          }
        }
      ]
    },
    {
      "$type": "WaypointDesc",
      "linkType": "NEXT_SEGMENT",
      "fuzzyRadius": 0,
      "coords": [
        {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 5.999437,
            "y": 49.50566
          }
        }
      ]
    }
  ],
  "details": {
    "segments": true,
    "featureDescriptions": true
  },
  "callerContext": {
    "properties": [
      {
        "key": "CoordFormat",
        "value": "OG_GEODECIMAL"
      },
      {
        "key": "ProfileXMLSnippet",
        "value": "<Profile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><FeatureLayer majorVersion='1' minorVersion='0'><Themes><Theme id='PTV_TruckAttributes' enabled='true'/></Themes></FeatureLayer><Routing majorVersion='2' minorVersion='0'><Course><AdditionalDataRules enabled='true'/></Course><Vehicle><Physical><Dimension maxHeight='150'/></Physical></Vehicle></Routing></Profile>"
      }
    ]
  }
}
But the route is about 4000 meter although the maxHeight oft he vehicle was set to 150 cm:

Code: Select all

"info": {
    "distance": 4033,
    "time": 347,
    "cost": 4223
  },
The only option to get a route through the height restricted segment is to allow seqment violation:

Code: Select all

{
  "waypoints": [
    {
      "$type": "WaypointDesc",
      "linkType": "NEXT_SEGMENT",
      "fuzzyRadius": 0,
      "coords": [
        {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 5.995894,
            "y": 49.510518
          }
        }
      ]
    },
    {
      "$type": "WaypointDesc",
      "linkType": "NEXT_SEGMENT",
      "fuzzyRadius": 0,
      "coords": [
        {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 5.999437,
            "y": 49.50566
          }
        }
      ]
    }
  ],
  "details": {
    "segments": true,
    "featureDescriptions": true
  },
  "options": [
    {
      "parameter": "ALLOW_SEGMENT_VIOLATIONS",
      "value": "true"
    },
    {
      "parameter": "COST_OF_SEGMENT_VIOLATIONS",
      "value": "0"
    }
  ],
  "callerContext": {
    "properties": [
      {
        "key": "CoordFormat",
        "value": "OG_GEODECIMAL"
      },
      {
        "key": "ProfileXMLSnippet",
        "value": "<Profile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><FeatureLayer majorVersion='1' minorVersion='0'><Themes><Theme id='PTV_TruckAttributes' enabled='true'/></Themes></FeatureLayer><Routing majorVersion='2' minorVersion='0'><Course><AdditionalDataRules enabled='true'/></Course><Vehicle><Physical><Dimension maxHeight='150'/></Physical></Vehicle></Routing></Profile>"
      }
    ]
  }
}
Then the route is shorter but contains violations:

Code: Select all

"info": {
    "distance": 845,
    "time": 105,
    "cost": 1210,
    "hasViolations": true
  },
Here is an example of one violating segment:

Code: Select all

{
      "firstPolyIdx": 14,
      "polyC": 2,
      "firstNodeIdx": 9,
      "nodeC": 2,
      "streetNoIdx": -1,
      "streetNameIdx": -1,
      "dirInfoIdx": -1,
      "accTime": 90,
      "accDist": 720,
      "iuCode": 52,
      "countryCode": "",
      "violations": [
        "FeatureLayer:themeId=PTV_TruckAttributes|ruleId=ptvTA_BM_2|maxHeight=460"
      ],
      "featureDescriptions": [
        {
          "themeId": "PTV_TruckAttributes",
          "description": "driveType=0|maxHeight=460"
        }
      ],
      "nC": "CITY_ROAD",
      "vNorm": 0
    },
What could be the cause of this calculation/violation? I would expect that the Parameter maxHeight=150 would allow Routing throught the height restricted seqment?

Thanks in advance!

Best Regards,
Florian
Joost
Posts: 307
Joined: Fri Apr 25, 2014 1:46 pm

Re: Route calculation and PTV_TruckAttributes

Post by Joost »

In you snippet you are using the attribute maxHeigth='150'. This should heigth='150'.
Joost Claessen
Senior Technical Consultant
PTV Benelux
Joost
Posts: 307
Joined: Fri Apr 25, 2014 1:46 pm

Re: Route calculation and PTV_TruckAttributes

Post by Joost »

Also, did you alter your default profile? I was kind of suprised that the internal setting for heigth was bigger then the 460 so I checked this and it isn't. When I ran you request against our cloud I always get the shorter route.
Joost Claessen
Senior Technical Consultant
PTV Benelux
fstrahberger
Posts: 9
Joined: Fri Mar 09, 2018 2:17 pm

Re: Route calculation and PTV_TruckAttributes

Post by fstrahberger »

Hallo Joost,

many thanks for your answer.

I have changed maxHeigth='150' to heigth='150' - it still calculates the longer route.

Next I have added all Physical attributes from Default.xml to the request - xRoute still calculates the longer route.

Code: Select all

{
  "waypoints": [
    {
      "$type": "WaypointDesc",
      "linkType": "NEXT_SEGMENT",
      "fuzzyRadius": 0,
      "coords": [
        {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 5.995894,
            "y": 49.510518
          }
        }
      ]
    },
    {
      "$type": "WaypointDesc",
      "linkType": "NEXT_SEGMENT",
      "fuzzyRadius": 0,
      "coords": [
        {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 5.999437,
            "y": 49.50566
          }
        }
      ]
    }
  ],
  "details": {
    "segments": true,
    "featureDescriptions": true
  },
  "callerContext": {
    "properties": [
      {
        "key": "CoordFormat",
        "value": "OG_GEODECIMAL"
      },
      {
        "key": "ProfileXMLSnippet",
        "value": "<Profile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><FeatureLayer majorVersion='1' minorVersion='0'><Themes><Theme id='PTV_TruckAttributes' enabled='true'/></Themes></FeatureLayer><Routing majorVersion='2' minorVersion='0'><Course><AdditionalDataRules enabled='true'/></Course><Vehicle><Physical><Drive><Emissions emissionClass='EURO_3'/><Engine cylinderCapacity='1800' fuelType='EUROSUPER' fuelConsumption='8.0'/></Drive><Weight emptyWeight='1250' totalPermittedWeight='1500' loadWeight='0'/><Axle axleLoad='0'/><Passenger maximumPermittedNumberOfPassengers='1'/><Dimension height='150' length='450' width='180'/></Physical></Vehicle></Routing></Profile>"
      }
    ]
  }
}
I don't know if anyone changed the Default Profile but I guess that it was not altered - here is the Content of the Default.xml:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Profile parent="featurelayer/silkysand-fl-*" xmlns:ns2="http://www.ptv.de/com/ptvag/xserver/engines/xpoidbaccess">
    <Common language="de" majorVersion="1" minorVersion="0"/>
    <TerritoryPlanning majorVersion="1" minorVersion="1">
        <SolutionQuality>
            <HighSolutionQuality>
                <PlanTerritories numberOfNearestNeighbors="5" considerActivities="true" compactnessLevel="2" solverTimeLimit="300" maximumNumberOfIterations="5" minimumRelativeImprovement="5" approximationTolerance="2" performPreprocessingStep="true" maximumNumberOfStarts="5"/>
                <DistributeLocations numberOfNearestNeighbors="5" considerActivities="true" compactnessLevel="2" solverTimeLimit="300" approximationTolerance="2" performPreprocessingStep="true" maximumNumberOfSamplings="100" />
            </HighSolutionQuality>
            <BasicSolutionQuality>
                <PlanTerritories numberOfNearestNeighbors="5" considerActivities="true" compactnessLevel="2" solverTimeLimit="300" maximumNumberOfIterations="5" minimumRelativeImprovement="5" reassignmentMethod="DECIDE" maximumNumberOfStarts="5"/>
                <DistributeLocations numberOfNearestNeighbors="5" considerActivities="true" compactnessLevel="2" solverTimeLimit="300" reassignmentMethod="DECIDE" maximumNumberOfSamplings="100" />
            </BasicSolutionQuality>
        </SolutionQuality>
    </TerritoryPlanning>
    <Routing majorVersion="2" minorVersion="0">
        <Waypoint maximumDistanceToSegment="1000">
            <LinkTypeConfiguration>
                <Road maximumDistanceForNetworkClass0="1000"/>
            </LinkTypeConfiguration>
        </Waypoint>
        <Algorithm aStarAggressiveness="1.3">
            <LevellingScopeByNetworkClass searchSpace="-1"/>
            <LevellingScopeByNetworkClass searchSpace="-1"/>
            <LevellingScopeByNetworkClass searchSpace="-1"/>
            <LevellingScopeByNetworkClass searchSpace="200"/>
            <LevellingScopeByNetworkClass searchSpace="20"/>
            <LevellingScopeByNetworkClass searchSpace="10"/>
            <LevellingScopeByNetworkClass searchSpace="10"/>
            <LevellingScopeByNetworkClass searchSpace="10"/>
        </Algorithm>
        <Course>
            <BasicDataRules>
                <VehicleSpecific>
                    <DeliveryVehicles segmentMalus="2501"/>
                    <EmergencyVehicles segmentMalus="2501"/>
                    <ProjectSpecificVehicles blockedSegmentMalus="2501"/>
                </VehicleSpecific>
                <Network rampMalus="10">
                    <MalusByNetworkClass malus="0"/>
                    <MalusByNetworkClass malus="0"/>
                    <MalusByNetworkClass malus="0"/>
                    <MalusByNetworkClass malus="10"/>
                    <MalusByNetworkClass malus="20"/>
                    <MalusByNetworkClass malus="50"/>
                    <MalusByNetworkClass malus="100"/>
                    <MalusByNetworkClass malus="100"/>
                </Network>
                <SpecialAreas residentialMalus="2500"/>
                <CombinedTransport ferryMalus="100" piggybackMalus="100"/>
            </BasicDataRules>
            <AdditionalDataRules>
                <SegmentSpecific useSegmentLength="true" useFerryLength="true" useFerryDuration="true" useUrbanAttribute="true" useRampAttribute="true" useSpeed="true" useBlockedForCarsAttribute="true" useBlockedForTrucksAttribute="true" useTollForCarsAttribute="true" useTollForTrucksAttribute="true"/>
            </AdditionalDataRules>
            <DynamicRouting>
                <SpeedMapping baseSpeed="1" mappedSpeed="1"/>
                <SpeedMapping baseSpeed="10" mappedSpeed="10"/>
                <SpeedMapping baseSpeed="20" mappedSpeed="20"/>
                <SpeedMapping baseSpeed="30" mappedSpeed="30"/>
                <SpeedMapping baseSpeed="40" mappedSpeed="40"/>
                <SpeedMapping baseSpeed="50" mappedSpeed="50"/>
                <SpeedMapping baseSpeed="60" mappedSpeed="60"/>
                <SpeedMapping baseSpeed="70" mappedSpeed="70"/>
                <SpeedMapping baseSpeed="80" mappedSpeed="80"/>
                <SpeedMapping baseSpeed="90" mappedSpeed="90"/>
                <SpeedMapping baseSpeed="100" mappedSpeed="100"/>
                <SpeedMapping baseSpeed="110" mappedSpeed="110"/>
                <SpeedMapping baseSpeed="120" mappedSpeed="120"/>
                <SpeedMapping baseSpeed="130" mappedSpeed="125"/>
                <SpeedMapping baseSpeed="140" mappedSpeed="125"/>
                <DynamicTimeStep size="900"/>
            </DynamicRouting>
        </Course>
        <Vehicle>
            <Physical>
                <Drive>
                    <Emissions emissionClass="EURO_3"/>
                    <Engine cylinderCapacity="1800" fuelType="EUROSUPER" fuelConsumption="8.0"/>
                </Drive>
                <Weight emptyWeight="1250" totalPermittedWeight="1500" loadWeight="0"/>
                <Axle axleLoad="0"/>
                <Passenger maximumPermittedNumberOfPassengers="1"/>
                <Dimension height="150" length="450" width="180"/>
            </Physical>
            <Speed>
                <SpeedRangeByNetworkClass minimumSpeed="70" maximumSpeed="135"/>
                <SpeedRangeByNetworkClass minimumSpeed="35" maximumSpeed="125"/>
                <SpeedRangeByNetworkClass minimumSpeed="25" maximumSpeed="85"/>
                <SpeedRangeByNetworkClass minimumSpeed="25" maximumSpeed="60"/>
                <SpeedRangeByNetworkClass minimumSpeed="20" maximumSpeed="50"/>
                <SpeedRangeByNetworkClass minimumSpeed="18" maximumSpeed="40"/>
                <SpeedRangeByNetworkClass minimumSpeed="9" maximumSpeed="16"/>
                <SpeedRangeByNetworkClass minimumSpeed="4" maximumSpeed="6"/>
            </Speed>
        </Vehicle>
        <Isochrone>
            <NodeBasedPolygon filterMode="WEAK" firstSmoothingAngle="3.0" secondSmoothingAngle="0.0"/>
        </Isochrone>
        <RouteList>
            <Maneuvers>
                <Bridges maneuvers="true" minimumLength="1000" maximumDistanceBehind="1000"/>
                <Tunnels maneuvers="true" minimumLength="1000" maximumDistanceBehind="1000"/>
                <Urban information="true" minimumNetworkClassForInformation="2" minimumDistanceForManeuvers="1000"/>
            </Maneuvers>
            <ManeuverGroups maximumDistanceBetweenManeuvers="500">
                <BoundingBox offset="1443"/>
            </ManeuverGroups>
        </RouteList>
        <AdditionalRules maximumAirLineDistance="4294967295">
            <ExceptionPaths>
                <Binary validate="true"/>
            </ExceptionPaths>
        </AdditionalRules>
    </Routing>
    <FeatureLayer majorVersion="1" minorVersion="0">
        <GlobalSettings enableTimeDependency="false"/>
        <Themes>
            <Theme id="PTV_TruckAttributes" enabled="false"/>
            <Theme id="PTV_PreferredRoutes" enabled="false"/>
            <Theme id="PTV_RestrictionZones" enabled="false"/>
            <Theme id="PTV_SpeedPatterns" enabled="false"/>
            <Theme id="PTV_TrafficIncidents" enabled="false"/>
        </Themes>
    </FeatureLayer>
    <Mapmatching majorVersion="1" minorVersion="0" probabilityBonusForBestCandidate="0.8" probabilityOutputThreshold="0.1">
        <Crawler movingDistanceRangeFactor="0.8" movingDistanceRangeMinimum="100" movingDistanceRangeMaximum="15000" maximumCrawlingJunctionCount="8" extendCrawlingRangeOnTurns="true" allowUTurns="true"/>
        <Weights linkingDistanceRating="0.2" headingDifferenceRating="0.8" transitionRating="0.0" inputDataQualityRating="0.0" reducedHeadingDifferenceRating="0.25"/>
        <HistoryConsideration enabled="true" maximumNumberOfConsecutiveFailedMatchings="50" maximumNumberOfElementsInHistory="900" maximumNumberOfCandidates="15" maximumNumberOfBadPredecessors="5" keepAllElementsInHistory="true"/>
        <GeometricDeviations maximumDistanceBetweenTrackPositionAndCandidate="25" maximumHeadingDifference="120.0" standstillDetectionSpeedThreshold="1.2" maximumPathRatingQuotient="10.0"/>
        <RoutingRestrictions considerBlockedSegments="true" considerTurningBans="false"/>
    </Mapmatching>
</Profile>
I think xRoute blocks all Segments that have an feature as soon as I activate PTV_TruckAttributes. :?
Joost
Posts: 307
Joined: Fri Apr 25, 2014 1:46 pm

Re: Route calculation and PTV_TruckAttributes

Post by Joost »

I can't explain the behavior. Looking at your request and default profile this should not happen. My best guess is that there is something wrong with you map installation. I would recommend that you create a support package as described in https://xserver.ptvgroup.com/forum/view ... f=43&t=474 and contact your normal support to open a ticket so they can investigate further.
Joost Claessen
Senior Technical Consultant
PTV Benelux
fstrahberger
Posts: 9
Joined: Fri Mar 09, 2018 2:17 pm

Re: Route calculation and PTV_TruckAttributes

Post by fstrahberger »

Many thanks I will do so :)
Post Reply