Route Matrix times identical for different transportModes

2 posts / 0 new
Last post
zjsteeve
Route Matrix times identical for different transportModes

Hi everyone,

I am trying to look at route matrix travel times for various transport modes. Regardless of what transport mode I set, however, The list of travel times between pairs of nodes are exactly the same. For example, if I use either of the following three URL's...

http://www.mapquestapi.com/directions/v2/routematrix?key=KEY&routeType=fastest&transportMode=driving&inFormat=json&json={locations:[{latLng:{lat:42.906734,lng:-78.883541}},{latLng:{lat:42.904947,lng:-78.879507}},{latLng:{lat:42.905871,lng:-78.885044}},{latLng:{lat:42.906281,lng:-78.88359}},{latLng:{lat:42.907313,lng:-78.882587}},{latLng:{lat:42.908871,lng:-78.883587}},{latLng:{lat:42.9061565314,lng:-78.8845432955}}],options:{allToAll:false,oneToMany:false,manyToOne:true,doReverseGeocode:false}}

or

http://www.mapquestapi.com/directions/v2/routematrix?key=KEY&routeType=fastest&transportMode=pedestrian&inFormat=json&json={locations:[{latLng:{lat:42.906734,lng:-78.883541}},{latLng:{lat:42.904947,lng:-78.879507}},{latLng:{lat:42.905871,lng:-78.885044}},{latLng:{lat:42.906281,lng:-78.88359}},{latLng:{lat:42.907313,lng:-78.882587}},{latLng:{lat:42.908871,lng:-78.883587}},{latLng:{lat:42.9061565314,lng:-78.8845432955}}],options:{allToAll:false,oneToMany:false,manyToOne:true,doReverseGeocode:false}}

or

http://www.mapquestapi.com/directions/v2/routematrix?key=KEY&routeType=fastest&transportMode=bicycle&inFormat=json&json={locations:[{latLng:{lat:42.906734,lng:-78.883541}},{latLng:{lat:42.904947,lng:-78.879507}},{latLng:{lat:42.905871,lng:-78.885044}},{latLng:{lat:42.906281,lng:-78.88359}},{latLng:{lat:42.907313,lng:-78.882587}},{latLng:{lat:42.908871,lng:-78.883587}},{latLng:{lat:42.9061565314,lng:-78.8845432955}}],options:{allToAll:false,oneToMany:false,manyToOne:true,doReverseGeocode:false}}

...I get the following response:

{"allToAll":false,"distance":[0,0.366,0.189,0.018,0.198,0.309,0.181],"time":[0,89,48,3,53,82,46],"locations":[{"latLng":{"lng":-78.883541,"lat":42.906734},"adminArea4":"","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"","street":"","adminArea1":"","adminArea3":"","type":"s","displayLatLng":{"lng":-78.883541,"lat":42.906734},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"LATLNG","geocodeQualityCode":"XXXXX","adminArea3Type":"State"},{"latLng":{"lng":-78.879507,"lat":42.904947},"adminArea4":"","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"","street":"","adminArea1":"","adminArea3":"","type":"s","displayLatLng":{"lng":-78.879507,"lat":42.904947},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"LATLNG","geocodeQualityCode":"XXXXX","adminArea3Type":"State"},{"latLng":{"lng":-78.885044,"lat":42.905871},"adminArea4":"","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"","street":"","adminArea1":"","adminArea3":"","type":"s","displayLatLng":{"lng":-78.885044,"lat":42.905871},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"LATLNG","geocodeQualityCode":"XXXXX","adminArea3Type":"State"},{"latLng":{"lng":-78.88359,"lat":42.906281},"adminArea4":"","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"","street":"","adminArea1":"","adminArea3":"","type":"s","displayLatLng":{"lng":-78.88359,"lat":42.906281},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"LATLNG","geocodeQualityCode":"XXXXX","adminArea3Type":"State"},{"latLng":{"lng":-78.882587,"lat":42.907313},"adminArea4":"","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"","street":"","adminArea1":"","adminArea3":"","type":"s","displayLatLng":{"lng":-78.882587,"lat":42.907313},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"LATLNG","geocodeQualityCode":"XXXXX","adminArea3Type":"State"},{"latLng":{"lng":-78.883587,"lat":42.908871},"adminArea4":"","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"","street":"","adminArea1":"","adminArea3":"","type":"s","displayLatLng":{"lng":-78.883587,"lat":42.908871},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"LATLNG","geocodeQualityCode":"XXXXX","adminArea3Type":"State"},{"latLng":{"lng":-78.884543,"lat":42.906157},"adminArea4":"","adminArea5Type":"City","adminArea4Type":"County","adminArea5":"","street":"","adminArea1":"","adminArea3":"","type":"s","displayLatLng":{"lng":-78.884543,"lat":42.906157},"linkId":0,"postalCode":"","sideOfStreet":"N","dragPoint":false,"adminArea1Type":"Country","geocodeQuality":"LATLNG","geocodeQualityCode":"XXXXX","adminArea3Type":"State"}],"manyToOne":true,"info":{"copyright":{"text":"© 2017 MapQuest, Inc.","imageUrl":"http://api.mqcdn.com/res/mqlogo.gif","imageAltText":"© 2017 MapQuest, Inc."},"statuscode":0,"messages":[]}}

 

 

...I also tried similar URL's where I set "routeType" equal to "driving", "pedestrian", or "bicycle" instead of "fastest," but still got the same response. I'm sure I'm constructing my request wrong. Does anyone know what I need to change to get times specific to the different transport modes??

 

Thank you so much!

 


MQBrianCoakley
The transportMode parameter
The transportMode parameter is only part of the response that indicates what mode each maneuver is. The routeType can be set to fastest, pedestrian, bicycle, etc for different methods of transportation. Also, make sure to set all route options in the json if using json input. The api will look for everything to be json, kvp, or xml except the key. So if locations are set as json then all options need to be set as json too. Otherwise the requests above look good. Here is how I did it...   http://www.mapquestapi.com/directions/v2/routematrix?key=KEY&inFormat=js...{locations:[{latLng:{lat:42.906734,lng:-78.883541}},{latLng:{lat:42.904947,lng:-78.879507}},{latLng:{lat:42.905871,lng:-78.885044}},{latLng:{lat:42.906281,lng:-78.88359}},{latLng:{lat:42.907313,lng:-78.882587}},{latLng:{lat:42.908871,lng:-78.883587}},{latLng:{lat:42.9061565314,lng:-78.8845432955}}],options:{routeType:pedestrian,allToAll:false,oneToMany:false,manyToOne:true,doReverseGeocode:false}}