exceptions.ApiError , code 2099

Hi,
I tried the following Code and it worked with the first coordinates (from Heidelberg)

import openrouteservice
from openrouteservice import convert

coords = ((49.397645, 8.689543),(49.388036, 8.690433))
client = openrouteservice.Client(key=’*****’) #just hide my token
geometry = client.directions(coords)[‘routes’][0][‘geometry’]
decoded = convert.decode_polyline(geometry)
print(decoded[“coordinates”])

but when I replace it with the following coordinates (from Sud Korea), it didn’t work:

import openrouteservice
from openrouteservice import convert

coords = ((36.253527, 128.228179),(36.251456, 128.254312))
client = openrouteservice.Client(key=’*****’) #just hide my token
geometry = client.directions(coords)[‘routes’][0][‘geometry’]
decoded = convert.decode_polyline(geometry)
print(decoded[“coordinates”])

I get this Error:

Traceback (most recent call last):
File “openroute.py”, line 19, in
geometry = client.directions(coords)[‘routes’][0][‘geometry’]
File “/home/vtd/anaconda3/lib/python3.6/site-packages/openrouteservice/client.py”, line 289, in wrapper
result = func(*args, **kwargs)
File “/home/vtd/anaconda3/lib/python3.6/site-packages/openrouteservice/directions.py”, line 247, in directions
return client.request("/v2/directions/" + profile + ‘/’ + format, {}, post_json=params, dry_run=dry_run)
File “/home/vtd/anaconda3/lib/python3.6/site-packages/openrouteservice/client.py”, line 206, in request
result = self._get_body(response)
File “/home/vtd/anaconda3/lib/python3.6/site-packages/openrouteservice/client.py”, line 239, in _get_body
body
openrouteservice.exceptions.ApiError: 500 ({‘error’: {‘code’: 2099, ‘message’: None}, ‘info’: {‘engine’: {‘version’: ‘5.0.2’, ‘build_date’: ‘2019-09-20T13:57:05Z’}, ‘timestamp’: 1569949231476}})

I also tried coordinates from China and India and I got the same Error.
Could you please help me !

[lon, lat], not [lat, lon]

1 Like

already taken in consideration. It’s not the problem!

Then please update your question with smth reproducible.

coords = ((36.253527, 128.228179),(36.251456, 128.254312))

This is not [lon, lat], but [lat, lon], i.e. wrong order.

The same for the HD example, just that the wrong order happens to actually exist apparently. 128 deg North is not valid though.

Thanks, it worked now. I really have to work with [lon, lat]. I didn’t take it in consideration in the rest of my program. But now I did and that was the Problem.

Dear support team, I get the same error code for some requests (see examples below).

I half-expect the directions API to throw an error with the selected profile (driving-car) because some of the coordinates are on islands that are inaccessible by car. However, I don’t know what the actual error is because the message is null. I have no control over where my users put their way points and would like to advise them on how to work around errors in the directions API (like by selecting a different profile for a certain leg). Without detailed information about which coordinates cause the problem that is not possible though. Would it be possible to

  1. extend the error with info about problematic coordinates?
  2. return an error message hinting at the problem (and list the problematic coordinates if you can’t do 1)?

I’d love to have a response like this:

error:{
code: 2099,
message: “Some coordinates are inaccessible in the selected profile. Maybe try a different one?”,
inaccessible: [
[153.099,-26.3818],
[153.129,-25.3602]
]
}

And if that’s too complicated, this would suffice:

error:{
code: 2099,
message: “Some coordinates are inaccessible in the selected profile: [153.099,-26.3818], [153.129,-25.3602] Maybe try a different one?”
}

If someone has a better idea on how to solve this problem, I’m open to other suggestions.
Thanks and kind regards!

##################################

REQUEST 1
curl ‘https://api.openrouteservice.org/v2/directions/driving-car/geojson’ -H ‘Sec-Fetch-Mode: cors’ -H ‘Origin: localhost’ -H 'Authorization: ’ -H ‘Content-Type: application/json’ -H ‘Accept: /’ -H ‘Referer: localhost’ -H 'User-Agent: ’ --data-binary ‘{“instructions”:false,“coordinates”:[[151.205,-33.8814],[146.826,-19.1375],[150.95,-23.1834],[153.099,-26.3818]]}’ --compressed

RESPONSE 1
{“error”:{“code”:2099,“message”:null},“info”:{“engine”:{“version”:“5.0.2”,“build_date”:“2019-09-20T13:57:05Z”},“timestamp”:1572558984144}}

REQUEST 2
curl ‘https://api.openrouteservice.org/v2/directions/driving-car/geojson’ -H ‘Sec-Fetch-Mode: cors’ -H ‘Origin: localhost’ -H 'Authorization: ’ -H ‘Content-Type: application/json’ -H ‘Accept: /’ -H ‘Referer: localhost’ -H 'User-Agent: ’ --data-binary ‘{“instructions”:false,“coordinates”:[[153.099,-26.3818],[153.129,-25.3602],[153.406,-27.1377]]}’ --compressed

RESPONSE 2
{“error”:{“code”:2099,“message”:null},“info”:{“engine”:{“version”:“5.0.2”,“build_date”:“2019-09-20T13:42:22Z”},“timestamp”:1572558984001}}

Support? Do you have anything for me? Cheers!

Hi @forger ,
this doesn’t seem to be a simple thing as when building locally, the requests come back as expected (error messages saying that point x cannot be found), but on the servers that build globally the correct response doesn’t come back even though the software code running it is identical. So the first stage will be for us to rebuild graphs which will take a few days and then take it from there.

So walking into work and a brainwave hit me, and I managed to find out what was causing it to return a 2099 error. We are rolling out the fix onto the servers currently, so it should be back to normal in the next couple of hours.

1 Like

Is this maybe related to #601?

Jup, same thing right @adam? Can close that issue as well when the servers are updated.

Looks likely the same thing, but technically it is a bug in the code as there should be a check to make sure that if the parameter isn’t set, it goes to default handling.

Just checked back and I’m receiving beautiful error messages now, thanks guys <3
“Could not find point 9: 146.8260000 -19.1375000 within a radius of 350.0 meters.”
What’s the radius information about?

#########

REQUEST:
curl ‘https://api.openrouteservice.org/v2/directions/driving-car/geojson’ -H ‘Accept: /’ -H ‘Referer: my app’ -H ‘DNT: 1’ -H ‘User-Agent: my browser’ -H ‘Authorization: my key’ -H ‘Sec-Fetch-Mode: cors’ -H ‘Content-Type: application/json’ --data-binary ‘{“instructions”:false,“coordinates”:[[145.767,-16.9188],[148.718,-20.2689],[153.223,-28.5957],[153.292,-29.7566],[153.141,-30.3044],[152.979,-31.1867],[152.505,-32.1795],[151.63,-33.1592],[151.205,-33.8814],[146.826,-19.1375],[153.099,-26.3818],[153.129,-25.3602],[150.95,-23.1834]]}’ --compressed

RESPONSE:
{“error”:{“code”:2010,“message”:“Could not find point 9: 146.8260000 -19.1375000 within a radius of 350.0 meters.”},“info”:{“engine”:{“version”:“5.0.2”,“build_date”:“2019-11-14T08:49:09Z”},“timestamp”:1573755236709}}

Never mind, I looked at the source and found out that it’s probably about the radiuses parameter that I didn’t consider before. Thanks again!

https://github.com/GIScience/openrouteservice/blob/master/openrouteservice/src/main/java/heigit/ors/routing/RoutingProfileManager.java
https://openrouteservice.org/dev/#/api-docs/v2/directions/{profile}/post

radiuses:
A pipe list of maximum distances (measured in metres) that limit the search of nearby road segments to every given waypoint. The values must be greater than 0, the value of -1 specifies no limit in the search. The number of radiuses correspond to the number of waypoints.

Hey guys, the mysterious error 2099 without a message seems to be back.

@adam You had a helpful brainwave last time around. Can you help?

REQUEST:
curl ‘https:// api.openrouteservice .org/v2/directions/driving-car/geojson’
-H ‘authority: api.openrouteservice .org’
-H ‘dnt: 1’
-H ‘authorization: my auth key’
-H ‘content-type: application/json’
-H ‘accept: /
-H ‘user-agent: my browser’
-H ‘origin: my app’
-H ‘sec-fetch-site: cross-site’
-H ‘sec-fetch-mode: cors’
-H ‘sec-fetch-dest: empty’
-H ‘referer: my app’
-H ‘accept-language: en-US,en;q=0.9’
–data-raw ‘{“instructions”:false,“coordinates”:[[-2.90343,15.5966],[6.15234,22.0102]],“maximum_speed”:“100”,“radiuses”:[-1,-1]}’
–compressed

RESPONSE:
{“error”:{“code”:2099,“message”:null},“info”:{“engine”:{“version”:“6.7.0”,“build_date”:“2022-02-18T19:37:41Z”},“timestamp”:1649958175109}}

Hi @forger ,

I just had a quick look and it seems to be a problem relating to the -1 values (somewhere in the code the “no limit” for search radius isn’t being applied).

Can you raise an issue on the ors GitHub repo so that the developers can look into it?

Hi @forger,

I have looked into the corresponding issue #1179 and it doesn’t seem to me to be any problem with handling -1 radius values. Please note that as stated in the description of radiuses parameter

the value of -1 specifies using the maximum possible search radius.

This is different from using an unlimited search radius as there is actually a technical limit to it. This limit is currently set to be around a few kilometers in the ORS public API.

Are you positive that you have entered your coordinates in the intended order? I’m asking because it is actually a quite common mistake to swap the longitude/latitude values. In fact, a query with switched coordinate values and "radiuses":[-1,-1] results in a valid route, see below.

Cheers,
Andrzej

1 Like