Share via

Post Route Directions - missing InputIndex(s) in response

Andrew Martin 0 Reputation points
2026-03-18T16:59:39.2066667+00:00

Some items in the RouteDirectionsResponse are missing an InputIndex (Properties/Order/InputIndex) that should be populated. I am using this property to map back to the original list of waypoints that make up the route request.

For example if I route through the following waypoints, the middle waypoint will have this issue:

[38.73847, -9.15265], [41.92008, 12.51788], [44.437, 26.10435]

If I change the middle waypoint slightly in the request, it will return a correct InputIndex for all waypoints:

[38.73847, -9.15265], [41.92006, 12.51784], [44.437, 26.10435]

https://learn.microsoft.com/en-us/rest/api/maps/route/post-route-directions?view=rest-maps-2025-01-01&tabs=HTTP

travelMode: truck

routeOutputOptions": ["routePath", "itinerary"]

optimizeRoute: short

maxRouteCount: 1

Azure Maps
Azure Maps

An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.


2 answers

Sort by: Most helpful
  1. Karnam Venkata Rajeswari 1,475 Reputation points Microsoft External Staff Moderator
    2026-03-26T10:47:58.9233333+00:00

    Hello Andrew Martin,

    Welcome to Microsoft Q&A and Thank you for reaching out.

    When a route request is submitted, each input coordinate is first snapped to the nearest routable road location based on the selected travel mode .The routing engine then works with these derived, routable points rather than the raw input coordinates.

    In most cases, the service can clearly associate each snapped waypoint with a specific input coordinate and returns order.inputIndex accordingly. However, in certain edge cases—such as when a waypoint lies very close to a straight route segment, a junction, or another routable node—the snapped location may not be uniquely attributable to a single input waypoint. When this happens, the route is still calculated correctly, but the service may omit order.inputIndex for that waypoint because a confident one‑to‑one mapping cannot be established.

    This also explains the reason for very small coordinate adjustment results in different behavior. Slightly changing the waypoint causes it to snap to a different road segment or node, making it distinct enough for the service to reliably associate it with the original input index. As a result, order.inputIndex appears as expected.

    Consider implementing the following steps:

    1.Please do not assume that every input waypoint will always produce a response waypoint with order.inputIndex.

    2.For scenarios where strict mapping is required, consider,

    • Avoiding intermediate waypoints placed exactly on junctions or ambiguous road positions.
    • Applying small coordinate offsets to critical waypoints.
    • Using proximity‑based matching (within a small tolerance) as a fallback when order.inputIndex is not present.

     

    References:

    Route - Post Route Directions - REST API (Azure Maps) | Microsoft Learn

    Thank you!

    Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.

    0 comments No comments

  2. Faraz Siddiqui 425 Reputation points Microsoft Employee
    2026-03-26T01:01:44.7333333+00:00

    Assuming your coordinates are in [lat,lon] format, when you route through the first set of waypoints, I get inputIndex:1 (midpoint) in the response. I have copied the response feature object for that point. Note that the coordinates returned in the response will be slightly off from the actual waypoint since these are routable coordinates. What issue are you seeing?

     {
    
      "type": "Feature",
    
      "geometry": {
    
        "type": "Point",
    
        "coordinates": [
    
          12.5174,
    
          41.91978
    
        ]
    
      },
    
      "properties": {
    
        "durationInSeconds": 180,
    
        "distanceInMeters": 734,
    
        "routePathPoint": {
    
          "legIndex": 0,
    
          "pointIndex": 17061
    
        },
    
        "travelMode": "truck",
    
        "instruction": {
    
          "formattedText": "You have reached the waypoint at <street>Via Carlo Fea</street>. It is on the left",
    
          "maneuverType": "ArriveIntermediate",
    
          "text": "You have reached the waypoint at Via Carlo Fea. It is on the left",
    
          "drivingSide": "Right"
    
        },
    
        "address": {
    
          "countryRegion": {
    
            "ISO": "IT"
    
          }
    
        },
    
        "towardsRoadName": "Via Carlo Fea",
    
        "sideOfStreet": "Left",
    
        "steps": [
    
          {
    
            "maneuverType": "ArriveIntermediate",
    
            "routePathRange": {
    
              "legIndex": 0,
    
              "range": [
    
                17061,
    
                17061
    
              ]
    
            },
    
            "names": [
    
              "Via Carlo Fea"
    
            ]
    
          }
    
        ],
    
        "type": "Waypoint",
    
        "order": {
    
          "inputIndex": 1
    
        }
    
      }
    
    }
    
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.