none
api returns negative travelDuration RRS feed

  • Question

  • I am getting negative travelDuration and travelDurationTraffic from the api.

    Here is an example with api key removed:

    https://dev.virtualearth.net/REST/v1/Routes/Truck?key=<key>&wayPoint.1=41.0784729,-81.5152653&wayPoint.2=27.9758671,-82.7049526&routeAttributes=routeSummariesOnly

    relevant fields in the response:

              "travelDistance": 1075.696681,
              "travelDuration": -21417785,
              "travelDurationTraffic": -21417785

    What's up? Looks like you need to up your field type size in your computation code?


    Thursday, July 26, 2018 7:12 PM

Answers

  • Hi Ethan,

    The team has reviewed the other values around this error :

    I have verified that “routeAttribute=routeSummariesOnly” is working with Truck API. Please add it to the documentation.

    However, I found another option “routeAttributes=excludeItinerary” is not supported.

    The documentation change should be live so you can confirm.

    Sincerely,

    IoTGirl

    • Marked as answer by ethan joffe Wednesday, August 1, 2018 8:57 PM
    Tuesday, July 31, 2018 9:50 PM
    Owner

All replies

  • Hi Ethan,

    I have reproduced your results above and am asking the Bing Maps folks for guidance.  I'll get back to you when I hear from them.

    Sincerely,

    IoTGirl

    Thursday, July 26, 2018 8:52 PM
    Owner
  • Hi IoTGirl.


    While you are at it, can you ask them about my other posted issue:

    https://social.msdn.microsoft.com/Forums/en-US/b6e9e746-3ccc-4f4b-b077-5a0b43c4bb31/api-returns-with-timeout-error?forum=bingmapsservices

    Thanks!

    Ethan

    Thursday, July 26, 2018 9:18 PM
  • Hi,
    I assume this is happening since you're using unsupported parameter. There isn't routeAttributes=routeSummariesOnly available for Truck Routes, see here for supported parameters: https://msdn.microsoft.com/en-us/library/mt814923.aspx.

    Friday, July 27, 2018 9:45 AM
    Moderator
  • Hi S1mon_

    Thanks for the surprising answer.

    Unfortunately it introduces new, perhaps more serious issues . I have confirmed that removing the routeAttributes param does in fact seem to fix the negative value issue, however this means the API calls made up till now are not trustworthy.

    Note that if you pass an invalid value in the routeAttributes param, the api correctly returns an error:

    https://dev.virtualearth.net/REST/v1/Routes/Truck?key=<key>&wayPoint.1=41.0784729,-81.5152653&wayPoint.2=27.9758671,-82.7049526&routeAttributes=bogusValue

    response contains:

      "errorDetails": [
        "One or more parameters are not valid.",
        "routeAttributes: This parameter value has an invalid format."
      ],

    However when you pass routeAttributes=routeSummariesOnly, not only do you not get an error, but it returns what appears to be correct information, which is only discovered to be incorrect on close examination. I originally found the value 'routeSummariesOnly' on this page: https://msdn.microsoft.com/en-us/library/ff701717.aspx?f=255&MSPPError=-2147217396 , and in fact it has what appears to be the expected effect of excluding parts of the response that I dont need, significantly shrinking the response size.

    Can you confirm whether when I passed that parameter previously but got positive values, were they correct, or do I need to rerun the thousands of queries I previously sent because the data is not trustworthy?

    Clearly the API needs to be fixed to be trustworthy.. if that param value is not supported it should return an error response.

    Also, is my other issue being addressed? (I checked and that issue is not affected by the param) https://social.msdn.microsoft.com/Forums/en-US/b6e9e746-3ccc-4f4b-b077-5a0b43c4bb31/api-returns-with-timeout-error?forum=bingmapsservices

    Thanks

    Ethan


    Friday, July 27, 2018 6:09 PM
  • Hi Ethan,

    The Bing Maps team thanks you for finding this issue and has deployed a fix.  Can you confirm?

    Sincerely,

    IoTGirl

    Sunday, July 29, 2018 10:53 PM
    Owner
  • Hi IoTGirl.

    Not sure which of the 2 issues you wanted me to check on, but the timeout issue is still an issue:

    https://dev.virtualearth.net/REST/v1/Routes/Truck?key=<key>&wayPoint.1=41.0784729,-81.5152653&wayPoint.2=27.9758671,-82.7049526&routeAttributes=routeSummariesOnly

    However the negative value issue appears fixed, even with routeAttributes=routeSummariesOnly as a param:

    https://dev.virtualearth.net/REST/v1/Routes/Truck?key=<key>&wayPoint.1=41.0784729,-81.5152653&wayPoint.2=27.9758671,-82.7049526&routeAttributes=routeSummariesOnly

    Does this mean the documentation is now incorrect and that this is a valid parameter value for the truck API?

    Can I now trust the return values of the API regardless of valid/invalid parameter values?

    Thanks

    Ethan

    PS out of curiosity, if it is fixed, was the cause an incorrect field type, ie smallint vs bigint?
    Monday, July 30, 2018 5:49 PM
  • Hi Ethan,

    This thread is specific to the negative value.  I have responded independently to the other thread.

    As to your curiosity and the voracity of the fix, I have the following details:

    The negative travel time was a code bug. The engine was using the “RealTimeCost” to calculate the truck travel time, which should only apply to auto mode. I have applied the fix to use “RealTimeTruckCost” for summary calculation in truck mode, and verified the change.  Please have the poster confirm.

    I hope that answers your question on this topic.  Please use the other thread to comment on the timeout topic as I have provided the latest details on that issue in that thread.

    Sincerely,

    IoTGirl


    Monday, July 30, 2018 6:37 PM
    Owner
  • Hi IoTGirl.

    I think this is resolved, but there is still the outstanding question about whether &routeAttributes=routeSummariesOnly is a valid parameter value, since it appears to have the desired effect, but it is unknown whether it makes the return values untrustworthy as before, or if it is now a separate concern and should either be updated in code (return error "One or more parameters are not valid.") or documentation (list this as a valid parameter value for routeAttributes?

    Thanks

    Ethan

    Monday, July 30, 2018 6:50 PM
  • Hi Ethan,

    That value did not come up in the discussions regarding the negative value.  I provided your exact call for the reproduction so I would expect they would have mentioned it.  Calling a truck route with "RealTimeCost" should give the invalid value result as that is an invalid value for a truck route.

    Sincerely,

    IoTGirl

    Monday, July 30, 2018 7:21 PM
    Owner
  • Hi IotGirl.

    This issue was brought up earlier in this thread by S1mon_ .

    He pointed out that &routeAttributes=routeSummariesOnly was not documented as a valid parameter value, but the API does not return an error. So either :

    1. it is a valid parameter value, and the documentation needs to be updated

    2. it is not a valid parameter value and the API should return an error.

    Note that before the current fix was pushed, varying that parameter value affected the negative value results. As such they are tied together and must both be resolved to resolve this issue fully.

    Thanks

    Ethan

    Monday, July 30, 2018 7:26 PM
  • Hi Ethan,

    I have passed your question on but my assumption is:

    1. it is not an expected parameter so it is ignored

    2. an expected parameter with an invalid value would return an invalid parameter error.

    Sincerely,

    IoTGirl

    Monday, July 30, 2018 9:39 PM
    Owner
  • lol.. you should be correct but are not :)

    1. It is an expected parameter (it is listed as a valid parameter on https://msdn.microsoft.com/en-us/library/mt814923.aspx)

    2. The value is not listed as a supported value, but does not return invalid parameter error.

    3. It is not ignored, and in fact has the expected effect of removing information from the result.

    4. Before the recent supposedly unrelated fix, varying this parameter had an effect on the negative value issue.

    but thanks for passing it on.. let's see what they say.

    Thanks

    Ethan

    Monday, July 30, 2018 9:44 PM
  • Hi Ethan,

    The team has reviewed the other values around this error :

    I have verified that “routeAttribute=routeSummariesOnly” is working with Truck API. Please add it to the documentation.

    However, I found another option “routeAttributes=excludeItinerary” is not supported.

    The documentation change should be live so you can confirm.

    Sincerely,

    IoTGirl

    • Marked as answer by ethan joffe Wednesday, August 1, 2018 8:57 PM
    Tuesday, July 31, 2018 9:50 PM
    Owner