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 ?