Page 1 of 1

getting the time zone with xRoute

Posted: Tue Jul 21, 2015 10:47 am
by dsc
Hi,

you can determine the time zone for each stop and segment along the route.
The time zone for xServers is defined as UTC-offset. If you know the offset to UTC at a given position, you know the timezone of this position.

First you need correctly installed Feature Layer PTV_TimeZones - thats the basic Featue Layer used by all time dependend Feature Layers (PTV_TrafficIncidents, PTV_SpeedPatterns, ...)

Then you just have to set the [ResultListOption] <utcOffsets="true">

For Example I also used PTV_SpeedPaterns in this request:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <calculateRoute xmlns="http://types.xroute.xserver.ptvag.com" xmlns:ns2="http://baseservices.service.jabba.ptvag.com" xmlns:ns3="http://common.xserver.ptvag.com" xmlns:ns4="http://wrappertypes.service.jabba.ptvag.com" xmlns:ns5="http://exception.core.jabba.ptvag.com" xmlns:ns6="http://xroute.xserver.ptvag.com">
      <ArrayOfWaypointDesc_1>
        <ns6:WaypointDesc fuzzyRadius="0" linkType="NEXT_SEGMENT">
          <ns6:wrappedCoords>
            <ns3:Point>
              <ns3:point y="49.6092" x="6.0723"/>
            </ns3:Point>
          </ns6:wrappedCoords>
          <ns6:wrappedSegmentID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        </ns6:WaypointDesc>
        <ns6:WaypointDesc fuzzyRadius="0" linkType="NEXT_SEGMENT">
          <ns6:wrappedCoords>
            <ns3:Point>
              <ns3:point y="49.60169" x="6.10155"/>
            </ns3:Point>
          </ns6:wrappedCoords>
          <ns6:wrappedSegmentID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        </ns6:WaypointDesc>
      </ArrayOfWaypointDesc_1>
      <ArrayOfRoutingOption_2>
        <ns6:RoutingOption value="2014-11-05T17:00:00+01:00" parameter="START_TIME"/>
      </ArrayOfRoutingOption_2>
      <ArrayOfExceptionPath_3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <ResultListOptions_4 featureDescriptions="true" totalRectangle="false" boundingRectanglesOffset="0" boundingRectanglesC="0" tollManoeuvres="false" manoeuvreGroups="false" urbanManoeuvres="false" brunnelManoeuvres="false" manoeuvreAttributes="false" segmentAttributes="false" segments="true" dynamicInfo="true" detailLevel="STANDARD" polygon="true" binaryPathDesc="false" nodes="false" texts="false" manoeuvres="false" utcOffsets="true"/>
      <CallerContext_5>
        <ns2:wrappedProperties>
          <ns2:CallerContextProperty value="OG_GEODECIMAL" key="CoordFormat"/>
          <ns2:CallerContextProperty value="WKB" key="ResponseGeometry"/>
          <ns2:CallerContextProperty value="truckslow" key="Profile"/>
          <ns2:CallerContextProperty value="<Profile xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation="http:///xroute/schema/XRouteProfile.xsd"><Common language='en' majorVersion='1' minorVersion='0'/><Routing majorVersion='2' minorVersion='0'><Course><AdditionalDataRules enabled='true'/></Course></Routing><FeatureLayer majorVersion='1' minorVersion='0'><GlobalSettings enableTimeDependency='true'/><Themes><Theme id='PTV_SpeedPatterns' enabled='true'><FeatureDescription includeLanguageCode='true'><Property id='message' included='true'/></FeatureDescription></Theme></Themes></FeatureLayer></Profile>" key="ProfileXMLSnippet"/>
        </ns2:wrappedProperties>
      </CallerContext_5>
    </calculateRoute>
  </soap:Body>
</soap:Envelope>
You then get the absolute UTC-offsets in you routing result like:

Code: Select all

                        :
        <ns3:wrappedSegments>
          <ns3:RouteListSegment utcOffset="60" countryCode="" iuCode="52" vNorm="0" nC="CITY_ROAD" accDist="157" accTime="18" dirInfoIdx="-1" streetNameIdx="-1" streetNoIdx="-1" nodeC="2" firstNodeIdx="0" polyC="3" firstPolyIdx="0">
            <ns3:wrappedFeatureDescriptions>
              <ns3:FeatureDescription description="freeFlowSpeed=53|driveType=0" themeId="PTV_SpeedPatterns"/>
            </ns3:wrappedFeatureDescriptions>
          </ns3:RouteListSegment>
                        :
                        :
                        :
          <ns3:RouteListSegment utcOffset="60" countryCode="" iuCode="52" vNorm="0" nC="CITY_ROAD" accDist="2371" accTime="330" dirInfoIdx="-1" streetNameIdx="7" streetNoIdx="-1" nodeC="2" firstNodeIdx="42" polyC="2" firstPolyIdx="49">
            <ns3:wrappedFeatureDescriptions>
              <ns3:FeatureDescription description="freeFlowSpeed=44|driveType=0" themeId="PTV_SpeedPatterns"/>
            </ns3:wrappedFeatureDescriptions>
          </ns3:RouteListSegment>
          <ns3:RouteListSegment utcOffset="60" countryCode="" iuCode="52" vNorm="0" nC="CITY_ROAD" accDist="2412" accTime="337" dirInfoIdx="-1" streetNameIdx="7" streetNoIdx="-1" nodeC="2" firstNodeIdx="43" polyC="2" firstPolyIdx="50">
            <ns3:wrappedFeatureDescriptions>
              <ns3:FeatureDescription description="freeFlowSpeed=48|driveType=0" themeId="PTV_SpeedPatterns"/>
            </ns3:wrappedFeatureDescriptions>
          </ns3:RouteListSegment>
        </ns3:wrappedSegments>
        <ns3:wrappedStations>
          <ns3:WayPoint utcOffset="60" countryCode="" wayPointType="START" manoeuvreIdx="0" segmentIdx="0" nodeIdx="0" polyIdx="0" iuCode="52" accDist="0" accTime="0">
            <ns3:locationCoord wkb="AAAAAAFAGEoCr70Ec0BIzfn+uHEP"/>
            <ns3:matchCoord wkb="AAAAAAFAGEn7hEVJi0BIzfkSu26B"/>
          </ns3:WayPoint>
          <ns3:WayPoint [b]utcOffset="60" countryCode="" wayPointType="DEST" manoeuvreIdx="3" segmentIdx="40" nodeIdx="44" polyIdx="51" iuCode="52" accDist="2412" accTime="337">
            <ns3:locationCoord wkb="AAAAAAFAGGfzkXTBekBIzQPWxHJg"/>
            <ns3:matchCoord wkb="AAAAAAFAGGgARfsq50BIzQTlnmYY"/>
          </ns3:WayPoint>
        </ns3:wrappedStations>
                        :
 
P.S.: With this method you may also get the time zone for a particiular coodinate - therefore just calculate the route with the given coordinate as first and the same coodinate with a slight offset as second waypoint.

Hope this Info is of interest ;-)


Cheers

Daniel