none
A question to how to get warnings from itineraryItems

    Question

  • Hi,
    in my Javascript I do the following of my route:
    var items = legs[0].itineraryItems;
    then I can get some data with:
    items[i].maneuver
    items[i].distance
    items[i].durationInSeconds
    or
    items[i].formattedText

    I want to get some 'warnings' too, but I have no idea how to get for instance data like 'warningType' or 'text'...
    Please can someone help me ?

    Cheers-


    Dietrich

    Wednesday, March 20, 2019 8:26 AM

All replies

  • Hi,
    in my Javascript I do the following with my route:

    var items = legs[0].itineraryItems;

    Then I can get some real data with:
    items[i].maneuver
    items[i].distance
    items[i].durationInSeconds
    or
    items[i].formattedText

    I want to get some 'warnings' too, but I have no idea how to get for instance data like 'warningType' or 'text'...
    I tried
    var warn = legs[0].itineraryItems.warnings;
    to get the array of warnings - without success.

    Please can someone help me and show me the notation?

    Cheers-


    Dietrich

    Want to make an addition:
    This is my directionsManager setting:
    directionsManager.setRenderOptions({ itineraryContainer: '#directionsItinerary', displayStepWarnings: false });
    As you see, I set displayStepWarnings to false, but in the itineraryContainer ALL warnings are shown!!??


    Thursday, March 21, 2019 2:46 PM
  • An addition to 'displayStepWarnings = false'. The picture shows my itinerary with this option set to false.

    You can see a lot of warning:

    So I think, the option doesn't work.

    Cheers-


    Dietrich

    Friday, March 22, 2019 11:52 AM
  • Another addition:

    In the internet I found, how warnings are stored in the itinerary:

        warnings: [
            {
              severity: 'Minor',
              text: 'Minor Congestion: slow 1st Av/Northgate Way (#173) to Express Lanes Southern Entrance/Exit',
              warningType: 'Congestion'
            }
          ]

    It is a sample. Looks like options.
    An array of arrays??
    So I don't know how to read the value of 'severity'...

    Cheers-


    Dietrich

    Friday, March 22, 2019 4:22 PM
  • Hello friends and experts,

    is there no one out in this world to help me a little bit???

    Cheers-


    Dietrich

    Wednesday, March 27, 2019 7:34 AM
  • Hi dherrmann,

    Thank you for using the API and sending the questions.

    To surface the warnings in the response, you can add &ra=routepath . (ra is alias for parameter routeAttributes). 

    &ra=routeproperties is another option to surface the warnings if you don't want the full route path. 

    Thanks again for the questions and feedback. 

    Regards, 

    Ashley




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

    ra is an optional parameter to specify to include or exclude parts of the routes response.

    One or more of the following values:

    - excludeItinerary: Do not include detailed directions in the response. Detailed directions are provided as itinerary items and contain details such as written instructions and traffic location codes.
    - routePath: Include a set of point (latitude and longitude) values that describe the route’s path in the response.
    - transitStops: Include information about transit stops for transit routes.
    - routeSummariesOnly: Include only travel time and distance for the route, and do not provide other information. Only supported for 2 waypoint routes.
    - all: Used to specify the following attributes as a group: excluteItinerary, routePath, and transitStops.

    Note: When you set the routeAttributes parameter, the routePathOutput parameter is ignored.

    Example: ra=routePath,transitStops



    • Edited by Ashley Song Wednesday, March 27, 2019 5:30 PM
    Wednesday, March 27, 2019 5:27 PM
  • Thank you, Ashley, for your answer!

    But, I don't use virtualearth for getting some route data. I'm using BingMaps V8 WebControl ONLY in combination with Javascript. And I want to get all parameters of a route via Javascript programming. That should be the goal...

    Have a nice weekend-


    Dietrich

    Friday, March 29, 2019 9:17 AM
  • Hi - @Ashley!

    I tried your advice and found a solution for me. Thank you for the tipp.

    But I have something to say about the warning texts:
    I only can see the translation into German and there I had to make out that often the translation is very bad.
    The worst is that often words are cut off and then bound with the next word without a space...

    Can you repair this thing, please?

    Regards-


    Dietrich

    Friday, April 5, 2019 3:54 PM
  • Hi Dietrich,

    Can you provide a sample of the poor translation?

    1. What call was made?

    2. Can you show the English result and German result for comparison?

    3. Can you provide a sample of what you would expect?

    Sincere thanks,

    IoTGirl

    Friday, April 5, 2019 6:24 PM
    Owner
  • Hi,

    I made this call in VS (VB.net):
    My.Computer.Network.DownloadFile(
                "http://dev.virtualearth.net/REST/v1/Routes?wp.1=" + st + "&wp.2=" + zi + "&ra=routePath&c=de&du=km&o=xml&key=" + key, fn)
    (st is the startaddress, zi is the endaddress of the route, fn is the filename to save the xml)

    An English result I can't reproduce, but the German result is: "ErnstStau" (this should be 2 words in German!) (in English "serious traffic jam" ? or so, eventually?)

    Next question:
    My route crosses Czechia and although it should be German descriptions of the warnings generally, I get English text mixed with German. Sample:
    <Warning severity="None" warningType="AdminDivisionChange">Sie erreichen Středočeský kraj</Warning>
    <Warning to="50.06002,14.49164" origin="50.06172,14.50147" severity="Minor" warningType="ScheduledConstruction">Baustelle: At V korytech - Construction work.</Warning>

    Cheers-


    Dietrich


    • Edited by dherrmann Saturday, April 6, 2019 9:03 AM
    Saturday, April 6, 2019 8:58 AM
  • Thanks Dietrich, I have sent these details to the localization team for review.
    Monday, April 8, 2019 8:04 PM
    Owner