none
BING MAPS - Distance difference between API and WEB RRS feed

  • Question

  • Hello!

    I'm from Argentina and i have a distance difference between 2 points, here is my code:

    https://dev.virtualearth.net/REST/v1/Routes/DistanceMatrix?origins=-33.0741078316963,-68.9676695493862&destinations=-35.65288,-69.22172&travelMode=driving&o=xml&key=APIKey

    This code brings to me 369 kilometers.

    But, if I go to the website 

    https://www.bing.com/maps?rtp=pos.-33.0741078316963_%20-68.9676695493862~pos.-35.65288_-69.22172

    The Km are 453

    I need to get the same KM. How can i do this?


    • Edited by adrileosol Monday, July 20, 2020 8:07 PM
    Monday, July 20, 2020 8:07 PM

All replies

  • Hi Adrilosol,

    There are two potential problems:

    1. You are using Distance matrix for a set of two points.  You should be using single route (https://docs.microsoft.com/en-us/bingmaps/rest-services/routes/)

    2. You have not set the units to Kilometers 

    Your call should have:

    distanceUnit du Optional. The units to use for distance in the response. ExampledistanceUnit=km

    So your call should look something like:

    https://dev.virtualearth.net/REST/v1/Routes?wayPoint.1=-33.0741078316963,-68.9676695493862&wayPoint.2=-35.65288,-69.22172&distanceUnit=km&o=xml&key=APIKey

    Finally, I have tried both and I get 369 km for both the call and the website so they do match for me.


    Monday, July 20, 2020 9:12 PM
    Owner
  • Hi IoTGirl! Thanks for your help.

    My Bing Map is not the same like yours.

    One route is missing, i belive.

    On my map, the route diverts to "San Rafael", it doesnt go straigth like your map! :(

    I cant upload a screen shot.

    Distance unit by default is Km. But, i've tried it so.

    Tuesday, July 21, 2020 2:11 AM
  • Hi adrileosol,

    Again, it sounds like the other route is not optimal so would not be returned unless you force a waypoint that would cause that route to be chosen.  The API is giving the correct and shorter answer and the website is also giving the same result.

    Sincerely,

    IoTGirl

    Tuesday, July 21, 2020 5:31 AM
    Owner