I am using the Google directions API in my web application, is there any way to shorten the direction description provided by Google?
I mean, for example,
Take the 2nd right.
Take the 2nd left toward ...
Can I shorten it? It’s too long.
Can I make it just like this:
2nd right>2nd left>
Is there any way to modify the result? I am using PHP for developing the web application and the JSON format for displaying the API result.
edit:
The API result displays correctly. But I want to remove certain common words such as ‘Take’, ‘The’, ‘at’ etc
API result displaying part of my code:if ($data->status === 'OK') {
$route = $data->routes[0];
foreach ($route->legs as $leg) {
foreach ($leg->steps as $step) {
echo $step->html_instructions . "<br>\n";
This worked for me, hopefully it will work for you too…
EDIT:
For a more flexible solution, I have created this: