0zyxel0
January 10, 2022, 11:19pm
1
Good Day,
I am currently using the Direction POST Api provided in the playground and I would like use it in my project which is using NuxtJS as a framework.
Upon Trying the Direction Api GET Request in Postman
https://api.openrouteservice.org/v2/directions/wheelchair?api_key= {{API_KEY_ HERE}}&start=8.544372443855,47.37672570205281&end=8.556408201212708,47.3743808824198
This generates the correct result and provides the geometry points correctly.
But when trying to use the Direction API POST Request in Postman
The resulting geometry is garbled.
We also have tried using Axios library if this would be the same and the resulting data is the same.
I have also tried using the npm openrouteservice-js package and had similar results.
Would you be able to advise in what direction should I check to correctly get the geometry back like the Direction API GET request endpoint?
Thank you!
Hey,
the geometry you see returned from the default POST endpoint is an encoded polyline .
You can either decode this yourself or use the geojson
endpoint to have the result returned in the same format as with the GET endpoint.
Best regards
1 Like
Thank you! was there a reason why the default POST endpoint was encoded or this is a normal thing when handling geojson?
Hey,
I’m a bit puzzled by your question, as the default POST endpoint and the geojson POST endpoint are not related?
Best regards
0zyxel0
January 11, 2022, 10:15am
5
Oh, I was just wondering if encoding geometry coordinates inside a JSON response is the best practice for dealing with map data. As I am new to using map data and I’m not sure if there are best practices I should follow
I don’t know whether it is the best practice, but it is rather space efficient, especially when compared to geojson.
I’d suggest working with whatever is easiest for you to work with and worry about optimizations regarding this when the need arises
Best regards