Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically link to Google Maps route planner and always use car as preferred form of transport

Tags:

google-maps

I have some addresses and want to create links to the Google Maps route planner. You can link to it by simply visiting https://www.google.com/maps/dir/<address 1>/<address 2>/, e.g. https://www.google.com/maps/dir/Thompson+St,+New+York,+NY,+USA/Wooster+St,+New+York,+NY,+USA/

My problem here is, that for short distances, Google returns walking as the preferred form of transport (as in my link above). Which is good in terms of environment protection and keeping yourself healthy, but I definitely need the route with a car. How can I modify the link to always use car?

When visiting the link above, Google redirects to another URI with a lot of parameters. When I manually select car as form of transportation, the URI gets altered slightly into a new one: !3e0 gets added. But adding !3e0 or data=!3e0 to my link from above (https://www.google.com/maps/dir/Thompson+St,+New+York,+NY,+USA/Wooster+St,+New+York,+NY,+USA/data=!3e0) doesn't change anything. I also tried adding some of the other added parameters, but either they don't change anything or they contain the info about Thompson St. and Wooster St., so changing the readable parameters (<address 1/2>) doesn't work again.

like image 447
Reeno Avatar asked Feb 08 '15 14:02

Reeno


Video Answer


1 Answers

There is an official documentation now: https://developers.google.com/maps/documentation/urls/guide#directions-action

In your case the link would be:

https://www.google.com/maps/dir/?api=1&destination=Thompson+St,+New+York,+NY,+USA&travelmode=driving

like image 199
Fabian von Ellerts Avatar answered Nov 02 '22 23:11

Fabian von Ellerts