none
Error using Distance Matrix API RRS feed

  • Question

  • According to the Bing Maps documentation, you can only use the distance matrix API with travelmode set to "walking" for locations within North America.

    > walking (North America only, rest of world coming soon)

    When you use the walking travel mode in your Distance Matrix API request and use locations outside of North America you get the error message described on a page from this forum from June 2015 called "Using the Distance Matrix API for locations in Europe" which is quoted here:

    Using the Bing Maps Distance Matrix API for locations in Europe (and I believe anywhere else other than North America returns the error message: "Request accepted but some pairs could not be processed."

    I am getting the same error message in my API request, but my locations are all in North America.

    My POST request is synchronous.

    Here is my POST response

    {
      "authenticationResultCode": "ValidCredentials",
      "brandLogoUri": "http://dev.virtualearth.net/Branding/logo_powered_by.png",
      "copyright": "Copyright © 2019 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": 30.6142694996024,
                  "longitude": -96.3388579843115
                }
              ],
              "errorMessage": "Request completed but some pairs could not be processed.",
              "origins": [
                {
                  "latitude": 30.6142694996024,
                  "longitude": -96.3388579843115
                }
              ],
              "results": [
                {
                  "destinationIndex": 0,
                  "originIndex": 0,
                  "totalWalkDuration": 0,
                  "travelDistance": -1,
                  "travelDuration": -1
                }
              ]
            }
          ]
        }
      ],
      "statusCode": 200,
      "statusDescription": "OK",
      "traceId": [REMOVED IN CASE UNNECESSARY]
    }

    The Longitude and Latitude coordinates are within North America, so I'm not sure what else is causing this error message to appear.

    How do I solve this problem and get the API calls to return the requested results?

    Friday, October 25, 2019 3:14 AM

Answers

All replies

  • Hi KPe,

    You only have two co-ordinates so there is no matrix to be built.  Please use the routing API for this case.

    https://docs.microsoft.com/en-us/bingmaps/rest-services/routes/calculate-a-route

    Sincerely,

    IoTGirl

    • Marked as answer by KPe Friday, October 25, 2019 7:55 PM
    Friday, October 25, 2019 6:07 AM
    Owner
  • I'm testing to see if this solution will solve the problem, but for some reason i'm getting a 401 response from my GET request to the routes api.

    http://dev.virtualearth.net/REST/v1/Routes/Walking?wp.0=47.610,-122.107?wp.1=Seattle,WA?key={my key}

    (tried https and http)

    I'm using the same key as before. How do I solve this problem? 

    EDIT:

    Sorry I just realized I typed the URL incorrectly. I'm supposed to use "&" in place of "?" except for right after "Walking".


    • Edited by KPe Friday, October 25, 2019 7:47 PM
    Friday, October 25, 2019 4:42 PM