Matrix API 3500 Route Limit

Hi,

While experimenting with the ORS API, I’ve fallen foul of a limit in the Matrix API call of 3500 routes. This occurs of I submit more than 35 locations (in [[la1t, long1], [lat2, long2]…[latn, longn]] format).

The full error text message is;
{“error”:{“code”:6004,“message”:“Request parameters exceed the server configuration limits. Only a total of 3500 routes are allowed.”},“info”:{“engine”:{“build_date”:“2023-07-09T01:31:50Z”,“version”:“7.1.0”},“times
tamp”:1695644158399}}

For <= 35 locations, this does not equate to the usual (n * (n-1))/2 formula for counting all edges between all vertices in a fully connected graph.

Digging into the documentation, I see the following restriction on the Matrix API call ;
Locations (origin x destination) = 3.500 (e.g. 50 x 50) per request.

But 50 x 50 does not equal 3,500 (it’s 2500). Nor does 35 x 35 for that matter (that comes to 1225).

What’s going on here? How is the “number of routes” in a supplied list of co-ordinates calculated?

And in particular;
What is exactly meant by “origin x destination”? I presume it means that any listed node could be the start of the route (so for 50 nodes there are potentially 50 origins). Is this correct? If so, how do I specify one particular node as being the origin (so that the matrix is, say, 1 x 50)?

For context, I’m using ORS as part of a wider solution I’m developing to solve VRP optimization problems.

Any help greatly appreciated.

Thanks all,
Alan Mott

Hi @QuantumQuins,

origins corresponds to the sources parameter.
3500 is the hard limit of pairs you can calcualte in a single request. the 50 x 50 is an example (‘e.g.’) that is still within the limits. We should probably clarify that in the example.

All locations passed in locations can be assigned in sources and/or destinations via their index in the locations array. E.g.:
locations: [[9.70093,48.477473],[9.207916,49.153868],[37.573242,55.801281]],
sources: [0],
destinations: [1,2]
would produce durations from locations 0 to 1 and 0 to 2 resulting in 2 pairs being calculated (out of the maximum of 3500).

by default all locations are used for both sources and destinations so the maximums for a all to all matrix are:
59 sources and 59 destinations

or for single source or destinations could be:
1 source 3500 destinations
3500 sources 1 destinations

Best regards

1 Like