500 Internal Server Error

Hi,

I get a crash using the Directions Service (POST):

POST
https:// **api.openrouteservice.org** /v2/directions/driving-car

{"coordinates":[[-67.065889,50.840462],[-73.523337,45.525709]],"radiuses":[-1,200]}


response:
{
  "error": {
    "code": 2099,
    "message": null
  },
  "info": {
    "engine": {
      "version": "6.8.1",
      "build_date": "2023-03-05T05:01:48Z"
    },
    "timestamp": 1678718773890
  }
}

thank you,
Katerina

Hey,

this seems to be another instance of this bug.
In this case, I’d assume that openrouteservice is not able to find any routable point within the maximum search radius around your first point. The error message unfortunately isn’t clearly stating that.

Best regards

Ok I see. I should be getting a message similar to: “Could not find routable point within a radius of 350.0 meters of specified coordinate”

Maybe you can help me refine my geocode search then to get better waypoints.I’m trying to get directions using postal codes.

So first I get the waypoints for the postal codes G4R 4N9 and J4K 5G6

https://api.openrouteservice.org/geocode/search?layers=postalcode&text=G4R 4N9&boundary.country=CA

https://api.openrouteservice.org/geocode/search?layers=postalcode&text=J4K 5G6&boundary.country=CA

The problematic waypoints come from the G4R 4N9 postal code.

This the response:

{"geocoding":{"version":"0.2","attribution":"https://openrouteservice.org/terms-of-service/#attribution-geocode","query":{"text":"G4R 4N9","size":10,"layers":["postalcode"],"private":false,"boundary.country":["CAN"],"lang":{"name":"English","iso6391":"en","iso6393":"eng","via":"default","defaulted":true},"querySize":20,"parser":"libpostal","parsed_text":{"postalcode":"g4r 4n9"}},"engine":{"name":"Pelias","author":"Mapzen","version":"1.0"},"timestamp":1678723377778},"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-67.065889,50.840462]},"properties":{"id":"504901651","gid":"whosonfirst:postalcode:504901651","layer":"postalcode","source":"whosonfirst","source_id":"504901651","name":"G4R 4N9","postalcode":"G4R 4N9","postalcode_gid":"whosonfirst:postalcode:504901651","confidence":1,"match_type":"exact","accuracy":"centroid","country":"Canada","country_gid":"whosonfirst:country:85633041","country_a":"CAN","region":"Quebec","region_gid":"whosonfirst:region:136251273","region_a":"QC","continent":"North America","continent_gid":"whosonfirst:continent:102191575","label":"G4R 4N9, QC, Canada","addendum":{"concordances":{"gp:id":"23825719"}}},"bbox":[-67.065889,50.840462,-67.065889,50.840462]}],"bbox":[-67.065889,50.840462,-67.065889,50.840462]}

If I type the same postal code in Google maps I get 50.2876181689702, -66.17913133663046
If I then us these waypoints in the direction request it works.

POST
https:// **api.openrouteservice.org** /v2/directions/driving-car

{"coordinates":[[-66.17913133663046,50.2876181689702],[-73.523337,45.525709]],"radiuses":[-1]}

Is there a way to get more precise latitude and longitude from the search API ?

Hey,

yes, exactly :))

Our geocoding service uses Pelias, which is a wrapper around a bunch of different datasets. In this case, info is returned by whosonfirst, which yields the given coordinate.

This stems from this repo, who state:

As of this writing most but not all postal codes have geometries. That said only about 1,600 records have Polygon geometries. The remaining (~800K) postal codes have all been assigned an approximate geometry, specifically the centroid for their containing FSA.

I’d assume this applies here and the centroid for G4R is being used, which apparently lies in a rather rural area.

For a more precise response, I suppose a more precise query is needed.

Best regards