Azure Maps API, NO_ROUTES_FOUND, sometimes work in opposite direction

Morten Bested 0 Reputation points
2025-01-10T11:48:29.97+00:00

We are experiencing issues with the Route Matrix endpoint in the Azure Maps API.

Sometimes, the endpoint returns the error "NO_ROUTE_FOUND," even though the coordinates provided appear valid and correspond to typical residential buildings on regular streets. Interestingly, in some cases, the endpoint works correctly if the origin and destination coordinates are reversed.

We have experimented with various query parameters, such as routeType and traffic, but none of these adjustments seem to resolve the problem in the examples provided below.

Could someone clarify why this issue occurs and suggest how to ensure that the endpoint works correctly?

Example 1

This request returns NO_ROUTE_FOUND, but works when the direction is reversed:

Request URL:

POST https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&traffic=false&travelMode=car&routeType=fastest&subscription-key=xxxxx

Body:

{"origins": {"type": "MultiPoint","coordinates": [[12.30949,55.93047]]},"destinations": {"type": "MultiPoint","coordinates": [[12.61083,56.03292]]}}

Response:

StatusCode 400 / Cell could not be processed / NO_ROUTE_FOUND

When the coordinates are reversed, it seems to work:

Request URL:

POST https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&traffic=false&travelMode=car&routeType=fastest&subscription-key=xxxxx

Body:

{"origins": {"type": "MultiPoint","coordinates": [[12.61083,56.03292]]},"destinations": {"type": "MultiPoint","coordinates": [[12.30949,55.93047]]}}

Response:

StatusCode 200 / lengthInMeters: 23901

Example 2

This request always return statuscode 400 / NO_ROUTE_FOUND. Reversing the direction does not work:

Request:

POST: https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&traffic=false&travelMode=car&routeType=fastest&subscription-key=xxxxx

Body:

{"origins": {"type": "MultiPoint","coordinates": [[12.30949,55.93047]]},"destinations": {"type": "MultiPoint","coordinates": [[10.03783,56.46293]]}}

Response:

StatusCode 400 / Cell could not be processed / NO_ROUTE_FOUND

Example 3

Similar to the first example. Only works if the direction is reversed.

Request:

POST: https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&traffic=false&travelMode=car&routeType=fastest&subscription-key=xxxxx

Body:

{"origins": {"type": "MultiPoint","coordinates": [[12.47906,55.79410]]},"destinations": {"type": "MultiPoint","coordinates": [[12.61083,56.03292]]}}

Response:

StatusCode 400 / Cell could not be processed / NO_ROUTE_FOUND

When the coordinates are reversed, it seems to work:

Request:

POST: https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&traffic=false&travelMode=car&routeType=fastest&subscription-key=xxxxx

Body:

{"origins": {"type": "MultiPoint","coordinates": [[12.61083,56.03292]]},"destinations": {"type": "MultiPoint","coordinates": [[12.47906,55.79410]]}}

Response:

StatusCode 200 / lengthInMeters: 34100

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
778 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. rbrundritt 18,826 Reputation points Microsoft Employee
    2025-01-15T18:01:04.3566667+00:00

    The most common reasons for these types of errors are:

    • A route point that is more than 150 meters from a road segment.
    • One way streets sometimes can create issues
    • Incorrect map data.

    That said, I highly recommend trying the new Azure Maps routing service that is in preview as it corrects many of these issues: https://learn.microsoft.com/en-us/rest/api/maps/route?view=rest-maps-2024-07-01-preview

    1 person found this answer helpful.

  2. IoTGirl 3,296 Reputation points Microsoft Employee
    2025-01-25T14:23:11.0533333+00:00

    Further to Ricky's answer, you are calling the Matrix API with only 2 coordinates. In general that API is expecting a matrix of locations. Try the Route API Ricky recommended as it will take only two locations by design.


Your answer

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