Distance Variations - AlternativeRoutes

3 posts / 0 new
Last post
dswope@grcc.edu
Distance Variations - AlternativeRoutes

I am using the alternateRoutes API call and get significatly different answers then if I go to the consumer page and manually enter the addresses.

Manually Mapping: returns two routes:  16.7 m   and 21.7 m  (average:  19.2). 
API returns one route:  10.674

My goal is to eventually get up to 3 routes and average the differences for mileage reimbursement. 

Questions: 

  1. Should I be getting more than 1 route returned?  I have tried different addresses but only get one route in response
  2. Why are the values so different?
  3. Is there a more efficient API call I should be using?

API

http://open.mapquestapi.com/directions/v2/alternateroutes?key=MyKEY&from=4700 Canal Ave. SW, Grandville, MI  49418&to=3801 Leonard St. NE,Grand Rapids,MI,49525&MaxRoutes=3&narrativeType=none&manMaps=false&unit=m&outFormat=XML

Manual Mapping

http://www.mapquest.com - Consumer Mapping
https://www.mapquest.com/directions/from/us/mi/grand-rapids/49525/3801-leonard-st-ne/to/us/mi/grandville/49418/4700-canal-ave-sw

 


MQBrianCoakley
It looks like the issue is
It looks like the issue is the timeOverage parameter in the alternateRoutes request is specifically set differently on MapQuest.com. If you submit that alternateroutes request with timeOverage=50 (telling the directions api to return an alternate route as long as it is <= 150% of the time of the fastest route) then you'll get an alternate route back. In this case, the fastest route is 1011 seconds, the next fastest route (first alternate route) is 1476 seconds, which is ~46% slower than the fastest route. So you have to tell directions api that it's OK to return an alternate route as long as it is <= 46% slower than the fastest route.

dswope@grcc.edu
Thank You

Thank You