Azure Maps Distance Matrix Async API out of region error

Arnab Animesh Das 10 Reputation points
2025-04-20T06:50:55.7533333+00:00

The below mentioned request works with Azure Maps Distance Matrix Request synchronous API. But doesn't work with asynchronous API. Using synchronous API, I get proper distance matrix. But using asynchronous API, I get OUT_OF_REGION error. I am using 2025-01-01 version of the API.

Request:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPoint",
        "coordinates": [
          [
						72.0231125,
            22.4246468
          ],
          [
						74.1944529,
            17.4305762
          ]
        ]
      },
      "properties": {
        "pointType": "origins"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPoint",
        "coordinates": [
          [
						74.5697617,
            17.0466875
          ],
          [
						74.90918529999999,
            17.0381558
          ],
          [75.03775019999999, 17.1283837],
          [75.201229, 17.0715196]
        ]
      },
      "properties": {
        "pointType": "destinations"
      }
    }
  ],
    "traffic": "historical",
    "travelMode": "truck",
    "avoid": ["unpavedRoads"]
}

EDIT 1: I have added a few locations in the request. Some of them will appear in distance matrix as "out of region" in the async API, but will appear properly in sync API.

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

2 answers

Sort by: Most helpful
  1. Arnab Animesh Das 10 Reputation points
    2025-04-23T20:19:23.58+00:00

    API Limitations

    Expand table

    Max matrix size Max number of origins Max number of destinations Additional limits
    2500 1000 1000 All origins and destinations should be contained in an axis-aligned 400 km x 400 km bounding box. Otherwise some matrix cells will be resolved as OUT_OF_REGION.
    50,000 10,000 10,000 - departAt or arriveAt must be any. - traffic must be historical. - optimizeRoute must be fastest. - travelMode must be either driving or truck.  - No other parameters can be used explicitly.

    Answer:

    It seems when using avoid parameter, it falls within the 1st category. So, all the places need to be within 400km x 400 km bounding box. That was causing the issue.

    Once I removed that parameter from the request, the issue was fixed (as it came in the 2nd category where bounding box restriction is not there).

    1 person found this answer helpful.

  2. IoTGirl 3,616 Reputation points Microsoft Employee
    2025-04-21T19:02:24.3466667+00:00

    The Matrix API call is designed for a matrix of co-ordinates. If you only have two, please just call the Route API and not the Matrix. See https://learn.microsoft.com/en-us/rest/api/maps/route/post-route-directions?view=rest-maps-2025-01-01&tabs=HTTP


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.