Page 1 of 2

Toll costs details (c#) (xsers-1330)

Posted: Tue Feb 26, 2019 4:32 pm
by vnsilva
Hi

Any example of how to get toll costs details?

Best regards

Re: Toll costs details (c#)

Posted: Wed Feb 27, 2019 1:17 pm
by Oliver Heilig
Hello vnsilva,

do you need C# sample code for a specific xServer API function, or a general sample that shows which api to use for getting detailed toll?

Regards

Oli

Re: Toll costs details (c#)

Posted: Wed Feb 27, 2019 3:55 pm
by vnsilva
Hi

If can provide a general sample that shows which api to use for getting detailed toll...

Thank you.

Re: Toll costs details (c#)

Posted: Thu Feb 28, 2019 9:44 am
by Joost
Hello,

The quickest way to test toll calculation is to register for an xServer internet test account (if you have not done already) at https://www.ptvgroup.com/en/solutions/p ... /test-now/ . General information on how to connect to the cluster can be found at http://xserver.ptvgroup.com/en-uk/cookb ... g-started/ . An overview of the different clusters can be found at http://xserver.ptvgroup.com/dk/cookbook ... formation/ .

Them comes the choose between API version 1 and API version 2. At time of writing API version 1 only supports toll calculation in Europe. API version 2 supports toll calculation in USA with support for Europe scheduled this fall. My best guess would be that atm you need toll calculations for Europe so I would advise to use API version 1 for now.

A collection of small samples with explain use case step be step can be found at:
http://xserver.ptvgroup.com/fileadmin/f ... mples.html
Reference documentation for version 1 can be found at:
https://xserver.ptvgroup.com/fileadmin/ ... ation.html

Re: Toll costs details (c#)

Posted: Wed Mar 06, 2019 8:38 pm
by vnsilva
Hi

After some progress, I need help... again :)

I have a case that does not return values, I do not know if I'm doing something wrong.
this example there is a passage through a toll, but the PTV return 0€.

Image

Point A Coords: -8,4276403; 41,5454854
Point B Coords: -8,2917857; 41,44253

Code: Select all

//...
var rOption = new RoutingOption[]  {
     new RoutingOption{parameter=RoutingParameter.ROUTE_LANGUAGE, value="PT"},
     new RoutingOption{parameter=RoutingParameter.OPTIMIZATION, value="100"},
     new RoutingOption{parameter=RoutingParameter.ALLOW_SEGMENT_VIOLATIONS, value="True"},
     new RoutingOption{parameter=RoutingParameter.AVOID_HIGHWAYS, value="0"},
};

var callerContext = new CallerContext {
     wrappedProperties = new[] {
          new CallerContextProperty { key = "CoordFormat", value = "PTV_SMARTUNITS" },
          new CallerContextProperty { key = "ResponseGeometry", value = "WKB" },
          new CallerContextProperty { key = "Profile", value = "Truckfast"}
     }
};

xRoute.BegincalculateExtendedRoute(data.RequestWaypoints, rOption, null, new ResultListOptions { polygon = true },
     new CountryInfoOptions {
          detailedTollCosts = true,
          calculatePartTollCosts = true,
          namedToll = true,
          tollTotals = true,                            
          allEuro = true,
     }, callerContext, RouteExtentedCalculated, data);
//...

private void RouteExtentedCalculated() {
//...
     var routeExtended = xRoute.EndcalculateExtendedRoute(result);
     // create snapshot out of route result
     routeSnapshot = RouteSnapshot.FromXRoute(
          routeExtended.route.wrappedStations.Select(w => w.polyIdx).ToArray(),
          wkbReader.Read(routeExtended.route.polygon.wkb).Coordinates.Select(p => p.PtvSmartUnitsToWgs84()).ToArray(), 
          routeExtended.route.info, 
          routeExtended.wrappedCountryInfos 
     );
//...
}
Image

Re: Toll costs details (c#)

Posted: Thu Mar 07, 2019 8:33 am
by Bernd Welter
Hi Valter,

looks buggy, indeed. I created a Jira (XSERS-1330).

We get back with a statement from DEV soon.

Best regards,
Bernd

Re: Toll costs details (c#) (xsers-1330)

Posted: Wed Mar 13, 2019 9:31 am
by Bernd Welter
Hi there,

in the meantime we made some analysis:
  • Our data experts were able to reproduce
  • The provider data does not mention toll on the given section
  • Technically spoken: the server does a proper job
We will now check whether there's toll on that track (server response wrong, expectation correct) or not (server response proper, expectations wrong).

Best regards,
Bernd

Re: Toll costs details (c#) (xsers-1330)

Posted: Tue Mar 19, 2019 2:44 pm
by vnsilva
Hi there,

I'm having trouble again, I can not get the value of truck tolls.
The value returned is for a CAR

Can help?

I'm passing the following parameters...

Code: Select all

               var rOption = new RoutingOption[]  {
                        new RoutingOption{parameter=RoutingParameter.ROUTE_LANGUAGE, value="PT"},
                        rtOptimization = new RoutingOption { parameter = RoutingParameter.OPTIMIZATION, value = "100" },
                        new RoutingOption{parameter=RoutingParameter.ALLOW_SEGMENT_VIOLATIONS, value="True"},
                        new RoutingOption { parameter = RoutingParameter.AVOID_HIGHWAYS, value = "0" }
                };

                var callerContext = new CallerContext
                {
                    wrappedProperties = new[] {
                        new CallerContextProperty { key = "CoordFormat", value = "PTV_SMARTUNITS" },
                        new CallerContextProperty { key = "ResponseGeometry", value = "WKB" }
                    }
              

                    CountryInfoVehicleOptions countryInfoVehicleOptions = new CountryInfoVehicleOptions();
                    countryInfoVehicleOptions.namedToll = true;
                    countryInfoVehicleOptions.allEuro = true;
                    countryInfoVehicleOptions.detailedTollCosts = true;
                    countryInfoVehicleOptions.calculatePartTollCosts = true;
                    countryInfoVehicleOptions.tollTotals = true;
                    countryInfoVehicleOptions.wrappedOptions = new VehicleOption[]{
                        new VehicleOption {parameter = VehicleParameter.TYPE, value = "TRU" },
                        new VehicleOption {parameter = VehicleParameter.TOTAL_WEIGHT, value= "15000"},
                        new VehicleOption {parameter = VehicleParameter.TRAILER_WEIGHT, value= "20000"},
                        new VehicleOption {parameter = VehicleParameter.NUMBER_OF_AXLES, value= "4"},
                        new VehicleOption {parameter = VehicleParameter.HEIGHT, value= "400"},
                        new VehicleOption {parameter = VehicleParameter.LENGTH, value= "2000"},
                        new VehicleOption {parameter = VehicleParameter.EMISSION_CLASS, value= "EURO_4"},
                    };

                    xRoute.BegincalculateExtendedRoute(data.RequestWaypoints, rOption, null, new ResultListOptions { polygon = true },
                        countryInfoVehicleOptions, callerContext, RouteExtentedCalculated, data);

Re: Toll costs details (c#) (xsers-1330)

Posted: Mon Mar 25, 2019 11:54 am
by Bernd Welter
Hi,

please capture the complete request and response (xml or JSON) which is exchanged with the interface.
I need to see all details.

If needed we could set up a websession 1:1 but this will require a proper schedule.

Best regards,
Bernd

Re: Toll costs details (c#) (xsers-1330)

Posted: Mon Mar 25, 2019 6:18 pm
by vnsilva
capture done...

Resquest

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <calculateExtendedRoute xmlns="http://types.xroute.xserver.ptvag.com">
         <ArrayOfWaypointDesc_1>
            <WaypointDesc xmlns="http://xroute.xserver.ptvag.com" fuzzyRadius="0" linkType="AUTO_LINKING">
               <wrappedCoords>
                  <Point xmlns="http://common.xserver.ptvag.com">
                     <kml xsi:nil="true" />
                     <point x="3946845" y="5135369.0000000009" />
                  </Point>
               </wrappedCoords>
               <nodeID xsi:nil="true" />
               <wrappedRoutingOptions xsi:nil="true" />
               <wrappedSegmentID xsi:nil="true" />
               <wrappedVehicleOptions xsi:nil="true" />
               <viaType xsi:nil="true" />
            </WaypointDesc>
            <WaypointDesc xmlns="http://xroute.xserver.ptvag.com" fuzzyRadius="0" linkType="AUTO_LINKING">
               <wrappedCoords>
                  <Point xmlns="http://common.xserver.ptvag.com">
                     <kml xsi:nil="true" />
                     <point x="3961254.0000000005" y="5209817" />
                  </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 xmlns="http://xroute.xserver.ptvag.com" parameter="ROUTE_LANGUAGE" value="PT" />
            <RoutingOption xmlns="http://xroute.xserver.ptvag.com" parameter="OPTIMIZATION" value="80" />
            <RoutingOption xmlns="http://xroute.xserver.ptvag.com" parameter="ALLOW_SEGMENT_VIOLATIONS" value="True" />
            <RoutingOption xmlns="http://xroute.xserver.ptvag.com" xsi:nil="true" />
         </ArrayOfRoutingOption_2>
         <ArrayOfExceptionPath_3 xsi:nil="true" />
         <ResultListOptions_4 totalRectangle="false" tollManoeuvres="false" texts="false" segments="false" segmentAttributes="false" polygon="true" nodes="false" manoeuvreGroups="false" urbanManoeuvres="false" manoeuvreAttributes="false" dynamicInfo="false" detailLevel="BORDERS" brunnelManoeuvres="false" boundingRectanglesOffset="0" boundingRectanglesC="0" binaryPathDesc="false" manoeuvres="false">
            <cenEmissionConfiguration xmlns="http://xroute.xserver.ptvag.com" xsi:nil="true" />
            <destDetail xmlns="http://xroute.xserver.ptvag.com" xsi:nil="true" />
            <emissions xmlns="http://xroute.xserver.ptvag.com" xsi:nil="true" />
            <hbefaType xmlns="http://xroute.xserver.ptvag.com" xsi:nil="true" />
            <startDetail xmlns="http://xroute.xserver.ptvag.com" xsi:nil="true" />
         </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="TOTAL_WEIGHT" value="15000" />
               <q1:VehicleOption parameter="TRAILER_WEIGHT" value="20000" />
               <q1:VehicleOption parameter="NUMBER_OF_AXLES" value="4" />
               <q1:VehicleOption parameter="HEIGHT" value="400" />
               <q1:VehicleOption parameter="LENGTH" value="2000" />
               <q1:VehicleOption parameter="EMISSION_CLASS" value="EURO_4" />
            </q1:wrappedOptions>
         </CountryInfoOptions_5>
         <CallerContext_6>
            <wrappedProperties xmlns="http://baseservices.service.jabba.ptvag.com">
               <CallerContextProperty key="CoordFormat" value="PTV_SMARTUNITS" />
               <CallerContextProperty key="ResponseGeometry" value="WKB" />
            </wrappedProperties>
         </CallerContext_6>
      </calculateExtendedRoute>
   </s:Body>
</s:Envelope>
Response

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns4:calculateExtendedRouteResponse xmlns:ns4="http://types.xroute.xserver.ptvag.com" xmlns:ns0="http://wrappertypes.service.jabba.ptvag.com" xmlns:ns1="http://common.xserver.ptvag.com" xmlns:ns2="http://baseservices.service.jabba.ptvag.com" xmlns:ns3="http://xroute.xserver.ptvag.com" xmlns:ns6="http://exception.core.jabba.ptvag.com">
         <ns4:result>
            <ns3:wrappedCountryInfos>
               <ns3:CountryInfo additionalInfo="" countryCode="" currency="EUR" iuCode="51">
                  <ns3:partRouteInfo cost="0" time="28700" distance="378537" />
                  <ns3:wrappedPerNCRouteInfo>
                     <ns3:RouteInfo cost="0" time="0" distance="0" />
                     <ns3:RouteInfo cost="0" time="33" distance="1081" />
                     <ns3:RouteInfo cost="0" time="17941" distance="263286" />
                     <ns3:RouteInfo cost="0" time="7549" distance="87211" />
                     <ns3:RouteInfo cost="0" time="3120" distance="26703" />
                     <ns3:RouteInfo cost="0" time="57" distance="256" />
                     <ns3:RouteInfo cost="0" time="0" distance="0" />
                     <ns3:RouteInfo cost="0" time="0" distance="0" />
                  </ns3:wrappedPerNCRouteInfo>
                  <ns3:wrappedPerTypeTollDistance>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                  </ns3:wrappedPerTypeTollDistance>
                  <ns3:wrappedPerTypeTollPrice>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>16</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                     <ns0:Int>0</ns0:Int>
                  </ns3:wrappedPerTypeTollPrice>
                  <ns3:wrappedTollCostInfos>
                     <ns3:TollCostInfo currency="EUR" tollType="NATIONALTOLL" tollPrice="16" tollDistance="0" tollProviderID="23" tollSectionID="57665">
                        <ns3:tollStationFrom manoeuvreType="ENTER" routeListIndex="4215" tollLocationType="AE" tollStationID="3024" tollStationName="A4portico1 (entre Custoias-Via Norte Nascente)" />
                        <ns3:tollStationTo manoeuvreType="EXIT" routeListIndex="4215" tollLocationType="AE" tollStationID="3024" tollStationName="A4portico1 (entre Custoias-Via Norte Nascente)" />
                     </ns3:TollCostInfo>
                  </ns3:wrappedTollCostInfos>
               </ns3:CountryInfo>
            </ns3:wrappedCountryInfos>
            <ns3:wrappedPartTollCosts>
               <ns3:PartTollCosts distance="0">
                  <ns3:wrappedCosts>
                     <ns3:TollCost type="NATIONALTOLL" iuCode="51" currency="EUR" cost="16" />
                  </ns3:wrappedCosts>
               </ns3:PartTollCosts>
            </ns3:wrappedPartTollCosts>
            <ns3:route>
               <ns3:wrappedBoundingRectangles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
               <ns3:info hasViolations="false" cost="340620" time="28700" distance="378541" />
               <ns3:wrappedManoeuvreGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
               <ns3:wrappedManoeuvres xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
               <ns3:wrappedNodes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
               <ns3:polygon wkb="....Removed..." />
               <ns3:wrappedSegments xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
               <ns3:wrappedStations>
                  <ns3:WayPoint countryCode="" wayPointType="START" manoeuvreIdx="-1" segmentIdx="0" nodeIdx="0" polyIdx="0" iuCode="51" accDist="0" accTime="0">
                     <ns3:locationCoord wkb="AAAAAAFBThyugAAAAEFTlwJAAAAA" />
                     <ns3:matchCoord wkb="AAAAAAFBThyusNnzy0FTlwImDDZ9" />
                  </ns3:WayPoint>
                  <ns3:WayPoint countryCode="" wayPointType="DEST" manoeuvreIdx="0" segmentIdx="4312" nodeIdx="4815" polyIdx="5417" iuCode="51" accDist="378537" accTime="28700">
                     <ns3:locationCoord wkb="AAAAAAFBTjjTAAAAAEFT37ZAAAAA" />
                     <ns3:matchCoord wkb="AAAAAAFBTjjTSzcRdkFT37ZRde0y" />
                  </ns3:WayPoint>
               </ns3:wrappedStations>
               <ns3:wrappedTexts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
            </ns3:route>
         </ns4:result>
      </ns4:calculateExtendedRouteResponse>
   </soap:Body>
</soap:Envelope>