Request parameters exceed the server configuration limits

Hello.

I’m trying to compute a pairwise distance matrix. Apparently I’ve exceeded the total of routes are allowed by configuration. My API call consists of 597 locations, which means 356409 routes computation. I’ve made the corresponding changes in the config file (or so I think).

Config (app.config):

{
   "ors":{
     "info": {
       "base_url": "https://openrouteservice.org/",
       "support_mail": "support@openrouteservice.org",
       "author_tag": "openrouteservice",
       "content_licence": "LGPL 3.0"
      },
      "services":{
         "matrix":{
            "enabled":true,
            "maximum_locations":4000000,
            "maximum_visited_nodes":100000,
            "allow_resolve_locations":true,
            "attribution":"openrouteservice.org, OpenStreetMap contributors"
         },
         "isochrones":{
            "enabled":true,
            "maximum_range_distance":[
               {
                  "profiles":"any",
                  "value":50000
               },
               {
                  "profiles":"driving-car, driving-hgv, cycling-regular, foot-walking",
                  "value":100000
               }
            ],
            "maximum_range_time":[
               {
                  "profiles":"any",
                  "value":18000
               },
               {
                  "profiles":"driving-car, driving-hgv, cycling-regular, foot-walking",
                  "value":3600
               }
            ],
            "maximum_intervals":10,
            "maximum_locations":2,
            "allow_compute_area":true,
            "attribution":"openrouteservice.org, OpenStreetMap contributors"
         },
         "routing":{
            "enabled":true,
            "mode":"normal",
            "sources":[
               "/ors-core/data/north-america-latest.osm.pbf"
            ],
            "init_threads":1,
            "attribution":"openrouteservice.org, OpenStreetMap contributors",
            "distance_approximation":true,
            "profiles":{
               "active":[
                   "vehicles-car"
               ],
               "default_params": {
                   "encoder_flags_size": 8,
                   "graphs_root_path": "data/graphs",
                   "elevation_provider": "multi",
                       "elevation_cache_path": "data/elevation_cache",
                   "elevation_clear_cache": true,
                   "instructions": true,
                   "maximum_distance": 100000,
                   "maximum_segment_distance_with_dynamic_weights": 100000,
                   "maximum_waypoints": 50
               },
               "profile-vehicles-car":{
                  "profiles":"driving-car",
                  "parameters":{
                     "encoder_options":"consider_elevation=true|turn_costs=true|block_fords=false|use_acceleration=true",
                     "elevation":true,
                     "preparation":{
                        "min_network_size":200,
                        "min_one_way_network_size":200,
                        "methods":{
                           "ch":{
                              "enabled":true,
                              "threads":8,
                              "weightings":"fastest"
                           },
                           "lm":{
                              "enabled":true,
                              "threads":8,
                              "weightings":"fastest,shortest",
                              "landmarks":24
                           }
                        }
                     },

Erro message:

openrouteservice.exceptions.ApiError: 400 ({'info': {'timestamp': 1559749512432, 'engine': {'build_date': '2019-06-01T20:46:11Z', 'version': '5.0.1'}}, 'error': {'code': 6004, 'message': 'Request parameters exceed the server configuration limits. Only a total of 356409 routes are allowed.'}})

What could I be doind wrong?
Thank you in advance.

@ryuzakyl what is the maximum of locations that still works?

Can you try the latest master branch @ryuzakyl? I introduced a fix for matrix wrt to limits last week:

Note though, that you’ll have to adapt your app.config. Oh wait, that might the problem… Did you pull the latest master recently and didn’t change your app.config? See the note at the bottom of the PR comment linked above, that should fix it.

1 Like

Hi @timothy.

The the maximum amount of locations currently working is 50. For any number of locations greater than 50, I get the following error message:

openrouteservice.exceptions.ApiError: 400 ({'info': {'engine': {'build_date': '2019-06-01T20:46:11Z', 'version': '5.0.1'}, 'timestamp': 1559765930590}, 'error': {'code': 6004, 'message': 'Request parameters exceed the server configuration limits. Only a total of 3025 routes are allowed.'}})

Perhaps I should update some configurations in the app.config file. Any advice?
Thanks in advance.

That’s why I’m referring to. Please follow my advice and let us know if it worked.

Hi @nils.

It works!!! Thank you very much :wink:.

I apologize for failing to carefully read your previous response.

Thanks once again.
Best regards.

Very nice, glad to hear that :slight_smile:

Hello!
Im a complete n00b to the area, so please be patient! Im getting the same message as ryuzakyl, and my search led me to this post. I have about 150 locations (lat long encoded).

Where (on the website) can I find out what the limitations are? And if they can be overcome?

Thanks in advance for your response

@ryuzakyl was asking wrt to local installation. See here for instructions:

For our API you can see limits here:
https://openrouteservice.org/plans/
https://openrouteservice.org/restrictions/

1 Like

Ok, thank you for replying. I am using the API.

Ok, lets see if I understand correctly. If I use the API, with app.config on openrouteservice server, there is a limit on maximum number of routes that can be calculated (50x50=2500). If I try to install locally on my machine I can set ors.services.matrix.maximum_routes in app.config to something higher, like 150x150=22,500?

Yes, that’s correct :slight_smile:. There should be plenty of info for troubleshooting in this forum.

Good luck!

First, thank you for all the help youve given. I know Im completely new. I followed the instructions and installed on a server. Endpoints such as http://:8080/ors/status or http://:8080/ors/health appear to work from the browser, but when I call via the API (google apps script) it just doesnt work.

Do I need to install another ORS project to get this working?

I

but when I call via the API (google apps script) it just doesnt work.

Well, hard to troubleshoot with that description;)

What exactly is not working? I have no idea about google apps scripts, but shouldn’t matter, as long as it knows how to do HTTP(S) requests with POST and parse JSON’s.

Google Apps Script is based on Javascript. I have some sample code below, which calls ORS optimization:

  console.log("Hello. Start OptimizeRoute script....");
  //Get StartStop coordinates
  var url = 'https://api.openrouteservice.org/optimization';
  var locnFiles = DriveApp.searchFiles('fullText contains "Locn_Data" ');
  while (locnFiles.hasNext()) {
    var locnFile = locnFiles.next();
    var locnListStr = locnFile.getBlob().getDataAsString();
    var locnListObj = JSON.parse(locnListStr);
    console.log(locnListObj);  
    var options = {
          'headers' : {'ApplicationAccessKey' : '<MyApplication Access Key>',
                       'Accept' : 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8',
                       'Authorization': '<Authorization>' },
          'muteHttpExceptions': true,
          'method' : 'POST',
          'contentType': 'application/json',
          'payload' : locnListStr
      };
      var response = UrlFetchApp.fetch(url, options); 
      var data = JSON.parse(response.getContentText());
      console.log(data); 
      var respText = response.getContentText();
      console.log(response.getContentText());
    }
  }

This code works with url = ‘https://api.openrouteservice.org/optimization , UrlFetchApp returns from being called, with some result. In the url, if I substitute “api.openrouteservices.org” with the name of my server where I installed ORS, the call to UrlFetchApp just fails, doesnt return, and does log anything in the google apps script log file. However, if I go to the test links for my server, they work. E.g
http://{myServer}:8080/ors/routes?profile=driving-car&coordinates=8.676581,49.418204|8.692803,49.409465

Do I have to create api access to my server so I can call it the same way I call api.openrouteservice.org from google apps script?

Ah ok, now I know what you mean. In this case, yes, you’ll have to install more software, as the optimization endpoint is not from our stack. It’s sorta explained in the API playground, but you might’ve missed it.

So, you need the optimizer itself:

And it’s HTTP wrapper:

Both are fairly easy to set up. I’d recommend a 4 core processor, in contrast to ORS Vroom benefits from more processing power than RAM. FYI, we run it on 16GB RAM & 4 cores and can serve up to 30-50 concurrent requests. It calls ORS Matrix endpoint (or OSRM) for the durations, which typically takes longer than solving the VRP.

Our production environment comes from here (the only minor edit compared to upstream was a small change in URL):

Im sorry, it looks like a little bit too much work than I planned for, plus my “server” is an Amazon EC2 freebie that certainly wont come anywhere close to the specs you mentioned. Im doing this for a charity Im a part of, we need to organise up to 300 locations (lat long) so that we can save time and petrol money (gas) when we visit locations.

Im going to try to see if there is another way to achieve our goal. Thanks again for your advice and help!

1 Like

Hi there,
First of all for all the info you have provided :slight_smile:
I’m having an issue with the app installed on my local host where I’m running into the matrix route limit (which I believe is requests of up to 100 route)
{'error': {'code': 6004, 'message': 'Request parameters exceed the server configuration limits. Only a total of 100 routes are allowed.'}, 'info': {'engine': {'version': '6.3.1', 'build_date': '2020-12-15T21:54:52Z'}, 'timestamp': 1608069827458}}

I mounted a modified app.config and did a docker compose down and the up with the modified file.
I changed the limit to 1 million (I need a limit capable of doing 1000x1000)
"matrix": { "enabled": true, "maximum_routes": 1000000, "maximum_routes_flexible": 1000, "maximum_search_radius": 5000, "maximum_visited_nodes": 100000, "allow_resolve_locations": true, "attribution": "openrouteservice.org, OpenStreetMap contributors" },
I checked inside the container that the app.config file was correctly mounted on the container after doing the docker compose up, but when trying to run my request I still get the same error I shared above indicating the matrix request limit :frowning:

How could I get this to accept the larger request? I understand the performance of larger requests wont be stellar, but from smaller experiments it runns way faster than doing directions api requests for the same amount of routes :slight_smile:
I don´t know if it is relevant, but I am running the app allowing for 5 cores (12 threads) and max 8gb of ram :slight_smile: I plan on getting a more powerful machine tough, cpu stocks with the pandemic has been horrible :’(

Edit, after killing the container a couple of times and doing docker-compose up now it works :slight_smile:

Seems like I was doing something wrong or some sort of cache was causing my changes not to take effect.

Hello,

sorry for waking up this post but it seems the right place to ask my question. I installed an openservice server using docker on my laptop and cannot get rid of this error message using the matrix service:

Blockquote
{“error”:{“code”:6004,“message”:“Request parameters exceed the server configuration limits. Only a total of 100 routes are allowed.”},“info”:{“engine”:{“version”:“6.6.1”,“build_date”:“2021-10-15T13:04:18Z”},“timestamp”:1634459289068}}
{‘error’: {‘code’: 6004, ‘message’: ‘Request parameters exceed the server configuration limits. Only a total of 100 routes are allowed.’}, ‘info’: {‘engine’: {‘version’: ‘6.6.1’, ‘build_date’: ‘2021-10-15T13:04:18Z’}, ‘timestamp’: 1634459289068}}

Although I specified a large number of maximum routes in ors-config.json

Blockquote
“matrix”: {
“enabled”: true,
“maximum_routes”: 500000,
“maximum_routes_flexible”: 25,
“maximum_search_radius”: 5000,
“maximum_visited_nodes”: 100000,
“allow_resolve_locations”: true,
“attribution”: “openrouteservice.org, OpenStreetMap contributors”
},

I have tried many things, recreating the graph and all. I can get matrices for 10x10 points but cannot get that modification in ors-config.json to have any effect. Does someboy have any idea ?

Best,

Fabien