Odd route returned

6 posts / 0 new
Last post
sjohnsen
Odd route returned

One of our customers reported an odd result when using our implementation of mapquest.

From: 1810 Grand Ave, Glenwood Springs, CO 81601

To: 313 Chambers Ave, Eagle, CO 81631

By default, we request the FASTEST route.  Here is the abridged response:

<?xml version=""1.0"" encoding=""UTF-8""?>" & vbLf & "<response>
  <info>
    <statusCode>0</statusCode>
    <messages/>
    <copyright>
      <imageUrl>http://api.mqcdn.com/res/mqlogo.gif</imageUrl>
      <imageAltText>© 2017 MapQuest, Inc.</imageAltText>
      <text>© 2017 MapQuest, Inc.</text>
    </copyright>
  </info>
  <routeError>
    <errorCode>-400</errorCode>
    <message></message>
  </routeError>
  <route>
    <sessionId>59b1b300-01c1-0007-02b7-7235-00163e01ab69</sessionId>
    <options>
      <shapeFormat>raw</shapeFormat>
      <generalize>-1.0</generalize>
      <maxLinkId>1</maxLinkId>
      <narrativeType>text</narrativeType>
      <stateBoundaryDisplay>true</stateBoundaryDisplay>
      <countryBoundaryDisplay>true</countryBoundaryDisplay>
      <sideOfStreetDisplay>true</sideOfStreetDisplay>
      <destinationManeuverDisplay>true</destinationManeuverDisplay>
      <avoidTimedConditions>false</avoidTimedConditions>
      <enhancedNarrative>false</enhancedNarrative>
      <returnLinkDirections>false</returnLinkDirections>
      <timeType>0</timeType>
      <routeType>FASTEST</routeType>
      <locale>en_US</locale>
      <unit>M</unit>
      <tryAvoidLinkIds></tryAvoidLinkIds>
      <mustAvoidLinkIds></mustAvoidLinkIds>
      <manmaps>true</manmaps>
      <drivingStyle>2</drivingStyle>
      <highwayEfficiency>22.0</highwayEfficiency>
      <useTraffic>false</useTraffic>
    </options>
    <mapState>
      <center>
        <latLng>
          <lat>39.3873495</lat>
          <lng>-106.80308449999998</lng>
        </latLng>
      </center>
      <height>450</height>
      <width>675</width>
      <scale>867480</scale>
    </mapState>
    <boundingBox>
      <ul>
        <lat>39.662292</lat>
        <lng>-107.325157</lng>
      </ul>
      <lr>
        <lat>39.075855</lat>
        <lng>-106.28086</lng>
      </lr>
    </boundingBox>
    <distance>155.561</distance>
    <time>13505</time>
    <realTime>13836</realTime>
    <fuelUsed>7.37</fuelUsed>
    <formattedTime>03:45:05</formattedTime>
    <hasTollRoad>false</hasTollRoad>
    <hasFerry>false</hasFerry>
    <hasHighway>true</hasHighway>
    <hasSeasonalClosure>true</hasSeasonalClosure>
    <hasUnpaved>false</hasUnpaved>
    <hasCountryCross>false</hasCountryCross>
    <hasBridge>true</hasBridge>
    <hasTunnel>false</hasTunnel>
    <locations>
      <location>
        <street>1810 Grand Ave</street>
        <adminArea5 type=""City="""">Glenwood Springs</adminArea5>
        <adminArea3 type=""State="""">CO</adminArea3>
        <adminArea4 type=""County="""">Garfield</adminArea4>
        <postalCode>81601-4112</postalCode>
        <adminArea1 type=""Country="""">US</adminArea1>
        <geocodeQuality>POINT</geocodeQuality>
        <geocodeQualityCode>P1AAA</geocodeQualityCode>
        <dragPoint>false</dragPoint>
        <sideOfStreet>L</sideOfStreet>
        <displayLatLng>
          <latLng>
            <lat>39.534046</lat>
            <lng>-107.325157</lng>
          </latLng>
        </displayLatLng>
        <linkId>30504499</linkId>
        <type>s</type>
        <latLng>
          <lat>39.534047</lat>
          <lng>-107.325157</lng>
        </latLng>
      </location>
      <location>
        <street>313 Chambers Ave</street>
        <adminArea5 type=""City="""">Eagle</adminArea5>
        <adminArea3 type=""State="""">CO</adminArea3>
        <adminArea4 type=""County="""">Eagle</adminArea4>
        <postalCode>81631</postalCode>
        <adminArea1 type=""Country="""">US</adminArea1>
        <geocodeQuality>POINT</geocodeQuality>
        <geocodeQualityCode>P1AAA</geocodeQualityCode>
        <dragPoint>false</dragPoint>
        <sideOfStreet>L</sideOfStreet>
        <displayLatLng>
          <latLng>
            <lat>39.660316</lat>
            <lng>-106.823905</lng>
          </latLng>
        </displayLatLng>
        <linkId>30354769</linkId>
        <type>s</type>
        <latLng>
          <lat>39.660317</lat>
          <lng>-106.823903</lng>
        </latLng>
      </location>
    </locations>
    <locationSequence>0,1</locationSequence>
    <computedWaypoints/>
  </route>
</response>

I have been able to replicate this through my own testing.  If I tweak the request to return the SHORTEST route, I get a very different result:

<?xml version=""1.0"" encoding=""UTF-8""?>" & vbLf & "<response>
  <info>
    <statusCode>0</statusCode>
    <messages/>
    <copyright>
      <imageUrl>http://api.mqcdn.com/res/mqlogo.gif</imageUrl>
      <imageAltText>© 2017 MapQuest, Inc.</imageAltText>
      <text>© 2017 MapQuest, Inc.</text>
    </copyright>
  </info>
  <routeError>
    <errorCode>-400</errorCode>
    <message></message>
  </routeError>
  <route>
    <sessionId>59b19c6c-0068-0011-02b7-43ad-00163efc9f42</sessionId>
    <options>
      <shapeFormat>raw</shapeFormat>
      <generalize>-1.0</generalize>
      <maxLinkId>1</maxLinkId>
      <narrativeType>text</narrativeType>
      <stateBoundaryDisplay>true</stateBoundaryDisplay>
      <countryBoundaryDisplay>true</countryBoundaryDisplay>
      <sideOfStreetDisplay>true</sideOfStreetDisplay>
      <destinationManeuverDisplay>true</destinationManeuverDisplay>
      <avoidTimedConditions>false</avoidTimedConditions>
      <enhancedNarrative>false</enhancedNarrative>
      <returnLinkDirections>false</returnLinkDirections>
      <timeType>0</timeType>
      <routeType>SHORTEST</routeType>
      <locale>en_US</locale>
      <unit>M</unit>
      <tryAvoidLinkIds></tryAvoidLinkIds>
      <mustAvoidLinkIds></mustAvoidLinkIds>
      <manmaps>true</manmaps>
      <drivingStyle>2</drivingStyle>
      <highwayEfficiency>22.0</highwayEfficiency>
      <useTraffic>false</useTraffic>
    </options>
    <mapState>
      <center>
        <latLng>
          <lat>39.597181</lat>
          <lng>-107.0925705</lng>
        </latLng>
      </center>
      <height>450</height>
      <width>675</width>
      <scale>389327</scale>
    </mapState>
    <boundingBox>
      <ul>
        <lat>39.660316</lat>
        <lng>-107.361236</lng>
      </ul>
      <lr>
        <lat>39.534046</lat>
        <lng>-106.823905</lng>
      </lr>
    </boundingBox>
    <distance>36.816</distance>
    <time>2671</time>
    <realTime>2802</realTime>
    <fuelUsed>1.8</fuelUsed>
    <formattedTime>00:44:31</formattedTime>
    <hasTollRoad>false</hasTollRoad>
    <hasFerry>false</hasFerry>
    <hasHighway>true</hasHighway>
    <hasSeasonalClosure>false</hasSeasonalClosure>
    <hasUnpaved>false</hasUnpaved>
    <hasCountryCross>false</hasCountryCross>
    <hasBridge>true</hasBridge>
    <hasTunnel>true</hasTunnel>
    <locations>
      <location>
        <street>1810 Grand Ave</street>
        <adminArea5 type=""City="""">Glenwood Springs</adminArea5>
        <adminArea3 type=""State="""">CO</adminArea3>
        <adminArea4 type=""County="""">Garfield</adminArea4>
        <postalCode>81601-4112</postalCode>
        <adminArea1 type=""Country="""">US</adminArea1>
        <geocodeQuality>POINT</geocodeQuality>
        <geocodeQualityCode>P1AAA</geocodeQualityCode>
        <dragPoint>false</dragPoint>
        <sideOfStreet>L</sideOfStreet>
        <displayLatLng>
          <latLng>
            <lat>39.534046</lat>
            <lng>-107.325157</lng>
          </latLng>
        </displayLatLng>
        <linkId>30504499</linkId>
        <type>s</type>
        <latLng>
          <lat>39.534047</lat>
          <lng>-107.325157</lng>
        </latLng>
      </location>
      <location>
        <street>313 Chambers Ave</street>
        <adminArea5 type=""City="""">Eagle</adminArea5>
        <adminArea3 type=""State="""">CO</adminArea3>
        <adminArea4 type=""County="""">Eagle</adminArea4>
        <postalCode>81631</postalCode>
        <adminArea1 type=""Country="""">US</adminArea1>
        <geocodeQuality>POINT</geocodeQuality>
        <geocodeQualityCode>P1AAA</geocodeQualityCode>
        <dragPoint>false</dragPoint>
        <sideOfStreet>L</sideOfStreet>
        <displayLatLng>
          <latLng>
            <lat>39.660316</lat>
            <lng>-106.823905</lng>
          </latLng>
        </displayLatLng>
        <linkId>30354769</linkId>
        <type>s</type>
        <latLng>
          <lat>39.660317</lat>
          <lng>-106.823903</lng>
        </latLng>
      </location>
    </locations>
    <locationSequence>0,1</locationSequence>
    <computedWaypoints/>
  </route>
</response>

As you see, this route is both much shorter 36.8 vs 155.5 miles, but also much faster 00:44:31 vs 03:45:05.  Why, then, am I getting the longer route as the fastest?  If I go to your consumer site and perform the same search, the shorter route is returned as option 1.  Also, if I tweak the search and enter a slightly different starting point, 414 Hyland Park Dr, Glenwood Springs, CO 81601, which is practically next door, I also get the shorter route even when requesting the FASTEST:

<?xml version=""1.0"" encoding=""UTF-8""?>" & vbLf & "<response>
  <info>
    <statusCode>0</statusCode>
    <messages/>
    <copyright>
      <imageUrl>http://api.mqcdn.com/res/mqlogo.gif</imageUrl>
      <imageAltText>© 2017 MapQuest, Inc.</imageAltText>
      <text>© 2017 MapQuest, Inc.</text>
    </copyright>
  </info>
  <routeError>
    <errorCode>-400</errorCode>
    <message></message>
  </routeError>
  <route>
    <sessionId>59b2a13d-0162-0004-02b7-406c-00163e0300b8</sessionId>
    <options>
      <shapeFormat>raw</shapeFormat>
      <generalize>-1.0</generalize>
      <maxLinkId>1</maxLinkId>
      <narrativeType>text</narrativeType>
      <stateBoundaryDisplay>true</stateBoundaryDisplay>
      <countryBoundaryDisplay>true</countryBoundaryDisplay>
      <sideOfStreetDisplay>true</sideOfStreetDisplay>
      <destinationManeuverDisplay>true</destinationManeuverDisplay>
      <avoidTimedConditions>false</avoidTimedConditions>
      <enhancedNarrative>false</enhancedNarrative>
      <returnLinkDirections>false</returnLinkDirections>
      <timeType>0</timeType>
      <routeType>FASTEST</routeType>
      <locale>en_US</locale>
      <unit>M</unit>
      <tryAvoidLinkIds></tryAvoidLinkIds>
      <mustAvoidLinkIds></mustAvoidLinkIds>
      <manmaps>true</manmaps>
      <drivingStyle>2</drivingStyle>
      <highwayEfficiency>22.0</highwayEfficiency>
      <useTraffic>false</useTraffic>
    </options>
    <mapState>
      <center>
        <latLng>
          <lat>39.5979515</lat>
          <lng>-107.0925705</lng>
        </latLng>
      </center>
      <height>450</height>
      <width>675</width>
      <scale>389079</scale>
    </mapState>
    <boundingBox>
      <ul>
        <lat>39.660316</lat>
        <lng>-107.361236</lng>
      </ul>
      <lr>
        <lat>39.535587</lat>
        <lng>-106.823905</lng>
      </lr>
    </boundingBox>
    <distance>36.715</distance>
    <time>2692</time>
    <realTime>2729</realTime>
    <fuelUsed>1.8</fuelUsed>
    <formattedTime>00:44:52</formattedTime>
    <hasTollRoad>false</hasTollRoad>
    <hasFerry>false</hasFerry>
    <hasHighway>true</hasHighway>
    <hasSeasonalClosure>false</hasSeasonalClosure>
    <hasUnpaved>false</hasUnpaved>
    <hasCountryCross>false</hasCountryCross>
    <hasBridge>true</hasBridge>
    <hasTunnel>true</hasTunnel>
    <locations>
      <location>
        <street>414 Hyland Park Dr</street>
        <adminArea5 type=""City="""">Glenwood Springs</adminArea5>
        <adminArea3 type=""State="""">CO</adminArea3>
        <adminArea4 type=""County="""">Garfield</adminArea4>
        <postalCode>81601-4257</postalCode>
        <adminArea1 type=""Country="""">US</adminArea1>
        <geocodeQuality>ADDRESS</geocodeQuality>
        <geocodeQualityCode>L1AAA</geocodeQualityCode>
        <dragPoint>false</dragPoint>
        <sideOfStreet>R</sideOfStreet>
        <displayLatLng>
          <latLng>
            <lat>39.535587</lat>
            <lng>-107.322708</lng>
          </latLng>
        </displayLatLng>
        <linkId>30309150</linkId>
        <type>s</type>
        <latLng>
          <lat>39.535588</lat>
          <lng>-107.322711</lng>
        </latLng>
      </location>
      <location>
        <street>313 Chambers Ave</street>
        <adminArea5 type=""City="""">Eagle</adminArea5>
        <adminArea3 type=""State="""">CO</adminArea3>
        <adminArea4 type=""County="""">Eagle</adminArea4>
        <postalCode>81631</postalCode>
        <adminArea1 type=""Country="""">US</adminArea1>
        <geocodeQuality>POINT</geocodeQuality>
        <geocodeQualityCode>P1AAA</geocodeQualityCode>
        <dragPoint>false</dragPoint>
        <sideOfStreet>L</sideOfStreet>
        <displayLatLng>
          <latLng>
            <lat>39.660316</lat>
            <lng>-106.823905</lng>
          </latLng>
        </displayLatLng>
        <linkId>30354769</linkId>
        <type>s</type>
        <latLng>
          <lat>39.660317</lat>
          <lng>-106.823903</lng>
        </latLng>
      </location>
    </locations>
    <locationSequence>0,1</locationSequence>
    <computedWaypoints/>
  </route>
</response>

If there's something else I should be doing, please let me know.


MQBrianCoakley
The root of the issue is the
The root of the issue is the Grand Ave closure in Glenwood Springs (a road I know well and love) which is the only way to cross I-70 for a good distance. Alternate routes and draggable routes handle this much better and fastest route should. This has been forwarded on to the route team to assess. Thanks for the information.

sjohnsen
Update?

Hey Brian, thanks for the response.  Any updates from your route team?  We've checked this occasionally and the problem seems to persist.  Thanks.


MQBrianCoakley
There is no planned update to
There is no planned update to the directions code before the Nov 4 expiration date of the road closure. In the meantime, alternate routes takes a much better route. Just set maxRoutes to a value greater than one to get back alternate routes that can be evaluated.

sjohnsen
Confirmed, final questions.

Thanks, Brian.  Confirmed that maxRoutes=2 resolves the issue in this case.  From a billing perspective, if there are two routes available, does this count as two transactions?

Also, our current integration returns a static jpg image for the map and route.  In this case, with maxRoutes=2, only the "logical" route is returned which is fine.  When you say "get back alternate routes that can be evaluated" do you mean evaluated by the web service (i.e. shortest/fastest) or is there the potential to enable a dynamic control where the user can evaluate the routes?  Not something we're looking to do at the moment, but it got us thinking...


MQBrianCoakley
A route request is one
A route request is one transaction regardless of the number of routes returned or the number of locations in the route(s).   The alternate routes can be evaluated by the application or the user or any other agent that can make a decision based on the route response. The application can pick the one with the fewest turns, miles, etc. The user can pick the one that goes closest to the park, school, etc. It all depends on what the end product of the application is.