New Google Maps URLs – Directions Options (Part 3)

In this post we’ll look at various other options for restricting the route selection – “avoidance” options, transit preferences, and arrival/departure time.


There are three things you can ask Maps to avoid when determining routes – highways, tolls, and ferries. The first two are only relevant for driving; the last is also relevant for walking (and possibly bicycling, I haven’t checked). The following elements control these options when placed inside the marker !4m#!4m#!2m#:

!1b1 = Avoid highways
!2b1 = Avoid tolls
!3b1 = Avoid ferries

These are cumulative; to avoid ferries and tolls, but not worry about highways, you could use:

/data=!4m4!4m3!2m2!2b1!3b1

For transit routes, you can specify a preference for routes with fewer stops, or routes with less walking distance between connection points. This is specified by the !4m#!4m#!2m#!4e# element:

!4e0 appears to mean “pick the best (shortest) route”
!4e1 seems to be the same as !4e0
!4e2 = prefer routes with the fewest transfers
!4e3 = prefer routes with the least walking

You can also specify a preference for the type of transit to take via the !4m#!4m#!2m#!5e# element:

!5e0 = prefer bus routes
!5e1 = prefer subway routes
!5e2 = prefer train routes
!5e3 = prefer tram/light rail routes

So, to specify that you prefer bus routes with fewer transfers for transit routes, you would use:

/data=!4m4!4m3!2m2!4e2!5e0

In both cases, these are preferences and not true restrictions; Maps will ignore them if there are no routes matching your criteria.


Arrival and departure times are most useful for transit directions, but they also have utility for driving. There are three elements under the !4m#!4m#!2m# marker that control this option:

!6e# indicates departure or arrival
– !6e0 = Depart at (default)
– !6e1 = Arrive by
!8j# specifies the time and day of travel as the number of seconds elapsed since midnight on the morning of January 1, 1970.

!7e# indicates the time zone used for calculating time.
– !7e2 = Calculate from 1/1/70 0:00 Local Time
Any other value (or omitting this marker) will calculate from 1/1/70 0:00 UTC.

If you specify an arrive by or depart at day/time, Maps will select transit routes to meet your criteria, and will provide times for driving routes based on the usual traffic for that time frame. If there is sufficient traffic data for the area, a time range may be provided instead of a single “typical” time.

Let’s suppose you are staying at the Embassy Suites-Crystal City across the river from Washington, D.C., and want to take public transit to the Smithsonian Museum of Natural History. The museum opens at 10AM, so you’d like to arrive at least 10 minutes early. Assuming your travel date is Monday, August 10, 2015, you would represent this as:

The time calculation runs as follows:

Days from 1/1/1970 to 1/1/2015 = 45*365 + 11 leap days = 16436 days
Days from 1/1/2015 to 8/10/2015 = 31+28+31+30+31+30+31+9 = 221 days
So, 1/1/1970 to 8/10/2015 = 16436 + 221 = 16657 days
16657 days = 16657*24*60*60 = 1439164800 seconds
9:50 AM = 9hrs 50min = 540+50 = 590 min = 590*60 = 35400 seconds
So, 8/10/2015 9:50 AM = 1439164800 + 35400 = 1439200200

Breaking down the data options:

!4m6 – Map/route/display contents, 6 elements
|
+-!4m5 – Directions options, 5 elements
|
+-!2m3 – Route options, 3 elements
|    |
|    +-!6e1 – Arrive by
|    |
|    +-!7e2 – Calculate from local time
|    |
|    +-!8j1439200200 – Aug 10, 2015, 9:50 AM
|
+-!3e3 – Transit routes only

Thanks to Ricardo (below) for figuring out what the !7e2 marker was actually doing.

While testing and verifying his conclusions, I noticed something interesting. If, while sitting in the Eastern Time Zone, I requested directions for a location in the Pacific Time Zone and omitted !7e2, the route was calculated for Pacific Time but the time displayed in the options was Eastern Time. So, for example, if I specified the number of seconds for 11:00AM on a given date, the route provided would assume I wanted 4:00AM local (Pacific) time, but the options box would say 7:00AM.

If I then clicked the right arrow in the Options to move the time later by 20 minutes, the local time used to determine the route(s) would be increased not to 4:20AM, but to 7:20AM.


Return to New Google Maps URLs introduction

Advertisements
This entry was posted in Google Maps, Online Maps and tagged , . Bookmark the permalink.

4 Responses to New Google Maps URLs – Directions Options (Part 3)

  1. !7e2 apparently means use LOCAL TIME (not UTC). If omitted, or a value other than ‘2’ is used, the time used will be 4 hours (for folks on ET) before the time specified. For me, it was 7 hours off (I’m on PT).

  2. !4e# parameters seem to be ignored by gmaps app. Anyone noticed that, or know how to fix this?

    • mstickles says:

      Did not try this with the gmaps app since I don’t have a smartphone. I have picked up an Android tablet since first making these posts, though, so I’ll try to make some time to download the app and play with it and see what I can figure out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s