Closed Yamakasi closed 6 years ago
If I understand correctly, you’d like a PHP script or curl
call to be able to request directions from OSRM and get human-readable instructions as part of the response, correct? This library is designed to be run either on a server (as part of a Node.js-based API) or in a browser environment. The Mapbox Directions API relies on this library to provide instructions as part of the route response. You can use the API in curl
or PHP using that language’s standard library.
Thanks for the reply, indeed I'm looking for that but the Mapbox Directions API doesn't differ that much from the OSRM output, so that is where my question is. How to make it readable using what.
In the Directions API response, there are instructions
properties as well as voiceInstructions
and bannerInstructions
objects that provide instructions suitable for display and text-to-speech. Is there a particular aspect of the instructions that you consider unreadable?
Thanks for the update! I know that data is in but don't know how to use it with this projext. An example how to call it (serverside) would be very helpfull, I have seen someone else also asking for it but no usable answer there. Maybe update the Readme a little bit ?
If you use something like the Directions API, you don’t need this project; OSRMTI is working behind the scenes to make the instructions human-readable. You’d only need to use this project directly if you use OSRM directly. I don’t know for sure, but I suspect it’d be challenging to use OSRMTI directly on the server-side in a PHP environment, since OSRMTI requires a Node.js environment. With an existing API such as Mapbox’s, your PHP application can interact with the API over HTTP, sidestepping those challenges.
OK, thanks for the explanation! I'm running my own OSRM server but never heard about OSRMTI and cannot find that much about it as well so I think I need this project as well. I wrote my own API against OSRM so that works, I get the steps but I only need to make them readable.
Ah, I see. This documentation shows how you’d integrate your API with OSRMTI if your API is written in Node.js. On the other hand, if your API is written in PHP, then you may need to port OSRMTI to PHP. The good news is that index.js is pretty stable and fairly lightweight – the most important parts of this library are the translation files and test fixtures, which are all in JSON and therefore portable across languages.
OK, then I need to find out how to create a proof on concept out of the Docs, but that might needs some extention... the Docs. Or I'm overseeing something.
Hi,
Is this usable in a PHP/Curl call on the response ? I'd like to have a readable steps output as well and trying to figure out how!