Google Maps – How to Encode Preferences for Biking/Walking/Public Transport in Google Maps URL

google maps

I used to be able to specify a url parameter to automatically show public transport directions, but it stopped working and now I only get driving directions when I enter a URL like this: https://www.google.com/maps/dir/120+Spring+St,+Cambridge,+MA+02141/24+Cummington+Mall,+Boston,+MA+02215/ What is the parameter I should add to get biking, walking, or public transport directions? (something like ?mode=b)

Best Answer

Use this format:

https://www.google.com/maps/preview?saddr=[insert_from_address_here]&daddr=[insert_to_address_here]&dirflg=[insert_mode_here]

Options for dirflg:

  • w: walking
  • b: bicycling
  • d or h or t: drive
  • r: public transit

Example: if you want to bicycle from 120 Spring St, Cambridge, MA 02141 to 24 Cummington Mall, Boston, MA 02215, your URL would be:

https://www.google.com/maps/preview?saddr=120+Spring+St,+Cambridge,+MA+02141&daddr=24+Cummington+Mall,+Boston&dirflg=b