This question is answered at this link: https://answers.microsoft.com/en-us/bing/forum/all/bing-maps-api-distance-matrix-travel-mode-is/7bcd61ab-29a1-4275-b468-fd699d0ac18d.
Providing it for future viewers of this thread.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I'm on a Basic Education license for the Bing Maps REST services, and I'm using the Distance Matrix API (https://learn.microsoft.com/en-us/bingmaps/rest-services/routes/calculate-a-distance-matrix) in my project. I have noticed that for some reason setting the "travelMode" field has no effect on the results and the values ALWAYS default to as if the field is set to 'driving'. I have tried the following three synchronous GET requests with one origin-destination pair; the only difference between the three is the travel mode set. This error also occurs with POST requests.
The respective results are:
{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http://dev.virtualearth.net/Branding/logo_powered_by.png","copyright":"Copyright © 2021 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"DistanceMatrix:http://schemas.microsoft.com/search/local/ws/rest/v1","destinations":[{"latitude":38.8921643659989,"longitude":-77.032899662395891}],"origins":[{"latitude":38.895608013295444,"longitude":-77.033623168515092}],"results":[{"destinationIndex":0,"originIndex":0,"totalWalkDuration":0,"travelDistance":0.615,"travelDuration":115}]}]}],"statusCode":200,"statusDescription":"OK","traceId":"54c369965a0747dbae3d1c2e57f7775a|BN000021E1|0.0.0.0|BN0000185D"}
{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http://dev.virtualearth.net/Branding/logo_powered_by.png","copyright":"Copyright © 2021 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"DistanceMatrix:http://schemas.microsoft.com/search/local/ws/rest/v1","destinations":[{"latitude":38.8921643659989,"longitude":-77.032899662395891}],"origins":[{"latitude":38.895608013295444,"longitude":-77.033623168515092}],"results":[{"destinationIndex":0,"originIndex":0,"totalWalkDuration":0,"travelDistance":0.615,"travelDuration":115}]}]}],"statusCode":200,"statusDescription":"OK","traceId":"31072cc10f344c4cae43894932dbbee3|BN000021CC|0.0.0.0|BN0000185E"}
{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http://dev.virtualearth.net/Branding/logo_powered_by.png","copyright":"Copyright © 2021 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"DistanceMatrix:http://schemas.microsoft.com/search/local/ws/rest/v1","destinations":[{"latitude":38.8921643659989,"longitude":-77.032899662395891}],"origins":[{"latitude":38.895608013295444,"longitude":-77.033623168515092}],"results":[{"destinationIndex":0,"originIndex":0,"totalWalkDuration":0,"travelDistance":0.615,"travelDuration":115}]}]}],"statusCode":200,"statusDescription":"OK","traceId":"fca1dedc8b5c41048c7aa86f12a6a492|BN000021CC|0.0.0.0|BN0000185E"}
As you can see, the travelDistance and travelDuration values are the same for all three. If you check the coordinates on Bing Maps, you will see this these values correspond to driving (walking should be around 0.3 km and 4 min.). Any help would be greatly appreciated as it has taken days for me to narrow down this issue in my code.
Thank you!
PS @IoTGirl I saw you answer some similar questions about the Distance Matrix API previously. Perhaps you are the correct person I should be talking to? Thanks!
This question is answered at this link: https://answers.microsoft.com/en-us/bing/forum/all/bing-maps-api-distance-matrix-travel-mode-is/7bcd61ab-29a1-4275-b468-fd699d0ac18d.
Providing it for future viewers of this thread.
Thank you @kdglider8 for confirming :).
----------
For consistency let me post the answer provided https://answers.microsoft.com/en-us/bing/forum/all/bing-maps-api-distance-matrix-travel-mode-is/7bcd61ab-29a1-4275-b468-fd699d0ac18d here as well:
"
Distance Matrix is not designed for a single origin and destination pair but rather a matrix of coordinates so you need at least four(4) lat lon pairs for the smallest call. Please note that the Distance Matrix parameters are plural, "Origins" and "Destinations". You should be using the Routes API for a single route with two (2) waypoints. See Calculate a Route - Bing Maps | Microsoft Learn.
Walking:
Driving:
Transit:
These should get you the different routes and values you are looking for.
For a better understanding of Bing Maps Transactions all up, take a look at Understanding Bing Maps Transactions - Bing Maps | Microsoft Learn. Specifically for this question the REST Routes and Routes-Distance Matrix.
"