Important: Please read the Qt Code of Conduct -

Location: RouteLeg contains no steps member

  • Hi all,
    the API documentation of OSRM mentions an array of RouteStep objects which should be included in a RouteLeg object of a response when the query contains the steps=true option. Regarding the Qt source code that option is explicitly set in any route request of osrm v5. A response of a request submitted via curl on the command line contains those RouteStep objects. Neither RouteLeg nor the QGeoRouteLeg contain that array of RouteStep objects.
    Interestingly, the RouteManeuver contains a "step_index" in the extraAttributes object, which I recon is the index in the (missing) array of RouteStep objects.
    Is that array found somewhere else or is there any option/parameter I need to set to get this array?


  • After looking more deeper into the Qt source code I figured out that Qt uses the term "segment" instead of "step" and also found the method

    QGeoRouteParserOsrmV5Private::parseStep(const QJsonObject &step, int legIndex, int stepIndex)

    That method parses the RouteStep objects I was looking for. But unfortunately it does it incompletely. Although it checks whether the "intersections" property is an array but it doesn't inserts these into the returned RouteSegment object. That property of the RouteStep I was most interested in.
    It seems I've got to write my own QGeoRouteParser. :-(


Log in to reply