using CountryInfoVehicleOptions

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
nojas
Posts: 2
Joined: Fri Jul 05, 2019 12:40 pm

using CountryInfoVehicleOptions

Post by nojas »

Hello, I'm using the endpoint https://xroute-eu-n-test.cloud.ptvgroup ... endedRoute
to calculate the total toll for a give route. That works fine but I can't seem to find a way to use the CountryInfoVehicleOptions parameter or find another way to specify the type of truck/emmission class.
I did find the profile "truckfast" but I'd like to further specify the weight and emission rates
My current request looks as follows:

Code: Select all

{
    "waypoints": [
        {
            "coords": [
                {
                    "point": {
                    "x": 4.47056,
                    "y": 51.9229
                    }
                }
            ],
            "linkType": "NEXT_SEGMENT"
        },
        {
            "coords": [
                {
                    "point": {
                    "x": 13.41145,
                    "y": 52.52343
                    }
                }
            ],
            "linkType": "NEXT_SEGMENT"
        },
        {
            "coords": [
                {
                    "point": {
		    	"x": 11.58023,
                    "y": 48.13913
                    }
                }
            ],
            "linkType": "NEXT_SEGMENT"
        }

    ],
    "callerContext": {
        "properties": [
            {
                "key": "CoordFormat",
                "value": "OG_GEODECIMAL"
            },
            {
                "key": "ResponseGeometry",
                "value": "PLAIN,WKB"
            },
            {
                "key": "Profile",
                "value": "truckfast"
            }
        ]
    },
    "details": {
        "binaryPathDesc": false,
        "boundingRectanglesC": 0,
        "boundingRectanglesOffset": 0,
        "brunnelManoeuvres": false,
        "detailLevel": "BORDERS",
        "dynamicInfo": false,
        "manoeuvreAttributes": false,
        "manoeuvreGroups": false,
        "manoeuvres": false,
        "nodes": false,
        "polygon": false,
        "segmentAttributes": false,
        "segments": false,
        "texts": false,
        "tollManoeuvres": true,
        "totalRectangle": false,
        "urbanManoeuvres": false
    },
    "countryInfoOptions": {
    	"allEuro": true,
    	"tollTotals": true,
    	"detailedTollCosts": true
    }
}
I have tried variations of the following:

Code: Select all

    
"countryInfoOptions": {
    	"allEuro": true,
    	"tollTotals": true,
    	"detailedTollCosts": true,
    	"options": {
    		"VehicleOption": [
    			{
    				"parameter": "TYPE",
    				"value": "CAR"
    			}
    		]
    	}
    }
I hope you are able to show me the correct syntax (it took me a while to figure out that xlocate options require a type (for example:

Code: Select all

    "options": [
    	{
    		"$type": "SearchOption",
        	"param": "RESULT_LANGUAGE",
        	"value": "dut"
        },
        {
        	"$type": "SearchOption",
        	"param": "COUNTRY_CODETYPE",
        	"value": "1"
        }
        ],
but didn't manage to get the vehicle params in the xroute request. thanks in advance
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: using CountryInfoVehicleOptions

Post by Bernd Welter »

Hello Jason,

as CountryInfoVehicleOptions is a derived class it might be necessary to qualify it:
$type": "CountryInfoVehicleOptions",

Does this solve the issue?

Best regards,
Bernd

Code: Select all

{
  "waypoints": [
    {
      "$type": "TourPointDesc",
      "linkType": "AUTO_LINKING",
      "fuzzyRadius": 0,
      "servicePeriod": 0,
      "useServicePeriodForRecreation": false,
      "completeServiceInIntervals": false,
      "coords": [
        {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 671522,
            "y": 6869874
          }
        }
      ]
    },
    {
      "$type": "TourPointDesc",
      "linkType": "AUTO_LINKING",
      "fuzzyRadius": 0,
      "servicePeriod": 0,
      "useServicePeriodForRecreation": false,
      "completeServiceInIntervals": false,
      "coords": [
        {
          "$type": "Point",
          "point": {
            "$type": "PlainPoint",
            "x": 690761,
            "y": 6369874
          }
        }
      ]
    }
  ],
  "options": [
    {
      "parameter": "REQUEST_VERSION",
      "value": "1.6"
    },
    {
      "parameter": "COUNTRY_ENCODING",
      "value": "ISO2"
    },
    {
      "parameter": "ROUTE_LANGUAGE",
      "value": "EN"
    },
    {
      "parameter": "DISTANCE_MEASURE",
      "value": "KM"
    },
    {
      "parameter": "GENERATE_EXTWAYPOINTS",
      "value": "true"
    },
    {
      "parameter": "SPEED_INFOS",
      "value": "true"
    }
  ],
  "exceptionPaths": null,
  "details": {
    "manoeuvres": false,
    "texts": false,
    "nodes": false,
    "binaryPathDesc": false,
    "polygon": false,
    "polygonElevations": false,
    "detailLevel": "STANDARD",
    "dynamicInfo": false,
    "segments": false,
    "segmentAttributes": false,
    "segmentAttributePiggyback": false,
    "manoeuvreAttributes": false,
    "brunnelManoeuvres": false,
    "urbanManoeuvres": false,
    "manoeuvreGroups": false,
    "tollManoeuvres": false,
    "boundingRectanglesC": 0,
    "boundingRectanglesOffset": 1000,
    "totalRectangle": false,
    "extSegments": false,
    "speedLimits": false,
    "featureDescriptions": false,
    "utcOffsets": false
  },
  "countryInfoOptions": {
    "$type": "CountryInfoVehicleOptions",
    "detailedTollCosts": true,
    "allEuro": false,
    "calculatePartTollCosts": true,
    "namedToll": true,
    "tollTotals": true,
    "currencyDescription": true,
    "waypointIndexInTollCostInfo": true,
    "options": [
      {
        "parameter": "TYPE",
        "value": "TRUCK"
      }
    ]
  },
  "callerContext": {
    "properties": [
      {
        "key": "Profile",
        "value": "truckfast"
      },
      {
        "key": "CoordFormat",
        "value": "PTV_MERCATOR"
      },
      {
        "key": "ResponseGeometry",
        "value": "WKB,WKT"
      },
      {
        "key": "ProfileXMLSnippet",
        "value": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Profile><Routing majorVersion=\"2\" minorVersion=\"0\"><LinkWaypoint><LinkTypeConfiguration><Road onlyReachableRoads=\"false\"/></LinkTypeConfiguration></LinkWaypoint></Routing></Profile>"
      }
    ]
  }
}
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:
nojas
Posts: 2
Joined: Fri Jul 05, 2019 12:40 pm

Re: using CountryInfoVehicleOptions

Post by nojas »

Hello Bernd,

yes that works, I would never have derived that from the documentation.

thank you

Jason
User avatar
Bernd Welter
Site Admin
Posts: 2564
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: using CountryInfoVehicleOptions

Post by Bernd Welter »

Me too ;-)
Faced something similar in the past. It is a topic that occurs on client side but the transfer from "derived classes" need a "explicit type"-statement is "luck"...

Keep it in mind - it could happen at other places in the xServer universe and even outside, too!
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