Post Route Directions - Empty Route returned

Andrew Martin 20 Reputation points
2026-06-03T16:08:15.32+00:00

I'm getting an empty Feature response back for a specific route. Waypoints are as follows:

[53.96119, -1.09768], [54.29296, -0.40703], [53.96119, -1.09768]

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

Response: [{"Type":"FeatureCollection","Features":[]}]

Query AI answer: "The behavior is consistent with Azure Maps Route Directions returning no viable route when the constraints (mode, optimization, vehicle/truck settings, or waypoint order) make the trip impossible or invalid. When that happens, the service can return a valid GeoJSON wrapper (FeatureCollection) with an empty features array".

Previously this would actually return an error with "Invalid Route" or something to that effect. Can I just double check that this is no longer the case?

Azure Maps
Azure Maps

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


3 answers

Sort by: Oldest
  1. Amira Bedhiafi 43,046 Reputation points MVP Volunteer Moderator
    2026-06-04T10:38:21.1433333+00:00

    Hello Andrew !

    Thank you for posting on MS Learn Q&A.

    Try to check the waypoint coordinate order. The new API uses GeoJSON, so coordinates must be sent as [longitude, latitude], not [latitude, longitude].

    The coordinates in the question appear to be York / Scarborough style latitude longitude pairs:

    [53.96119, -1.09768],
    [54.29296, -0.40703],
    [53.96119, -1.09768]
    

    For Azure Maps Route Directions they should be:

    [-1.09768, 53.96119],
    [-0.40703, 54.29296],
    [-1.09768, 53.96119]
    

    If sent in the original order, Azure Maps interprets them as longitude 53.x and latitude -1.x, which places the points somewhere completely different and likely not on a routable road network. That can explain the empty FeatureCollection.

    Regarding the empty features array, the current API doc defines a successful response as a GeoJSON FeatureCollection, and errors are returned separately as Maps error responses. I would not rely only on anInvalid Route error message for no-route cases. In client code, treat 200 OK with features: [] as no route returned / not routable and handle it explicitly.

    So try to swap the coordinate order first then retest.

    Was this answer helpful?


  2. IoTGirl 4,126 Reputation points Microsoft Employee Moderator
    2026-06-09T00:07:41.01+00:00

    Hi Andrew,

    The 200 response indicates the co-ordinates were valid but that no "Truck" route could be found. We have a sample at https://samples.azuremaps.com/?search=truck&sample=car-vs-truck-route that gives both a truck and car route to demonstrate.

    Have you tried to change the default settings for the truck based on your real vehicle and load constraints?

    Default I only get the red route but if I change the settings I get a green one (Truck)

    User's image

    Sincerely,

    IoTGirl

    (MIcrosoft Maps Team Member)

    Was this answer helpful?

    0 comments No comments

  3. Karnam Venkata Rajeswari 5,255 Reputation points Microsoft External Staff Moderator
    2026-06-23T14:44:08.2966667+00:00

    Hello @Andrew Martin ,

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

    After reviewing the reported behavior, the request appears to be reaching the Azure Maps Route Directions service successfully and returning a valid GeoJSON response. The presence of an empty Features array indicates that the service returned a successful response, but no route could be generated for the specified travel mode and routing conditions. This points to a routing outcome rather than a request validation failure.

    Based on the behavior currently being observed, a valid route request can return an empty FeatureCollection when a route cannot be generated for the selected travel mode or routing constraints

    Please check if the following steps help-

    1. Verifying the coordinate format
      1. Confirm that coordinates are being sent in GeoJSON format using [longitude, latitude].
      2. Since the same locations reportedly work in driving mode, coordinate order appears less likely to be the primary cause. However, validating the raw request payload can help eliminate formatting concerns.
    2. Comparing truck and driving modes
      1. Execute the same request using driving mode.
      2. If driving succeeds while truck mode continues to return an empty route, this strongly suggests a truck-routing restriction, routing coverage limitation, or routability condition
    3. . Reviewing truck-specific parameters
      1. If the request includes vehicle dimensions, weight, axle weight, hazardous cargo settings, or commercial vehicle flags, temporarily remove or relax those values and retest.
      2. This can help identify whether a specific restriction is preventing route generation.
    4. Testing a simplified itinerary
      1. Route only from the first location to the second location (A → B).
      2. Temporarily remove the return leg (A → B → A).
      3. This can help determine whether a specific segment of the route is contributing to the behavior.
    5. Validating the optimizeRoute value
      1. If optimizeRoute is currently configured as "short", consider testing with documented values:
        • shortest
        • fastestWithoutTraffic
        • fastestWithTraffic
      2. Current documentation does not list "short" as a supported value. While there is insufficient evidence to conclude that this is the root cause, validating documented values can help eliminate an additional variable during troubleshooting.

    Based on the currently available information, the behavior appears most consistent with a truck-routing restriction, routability condition, routing coverage limitation or route-specific constraint rather than a malformed request or validation error.

    The following references might be helpful , please check them out

    Please let us know if the response was helpful

     

    Thank you

    Was this answer helpful?

    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.