This is the first in a set of posts covering the options for directions requests. This post will look at selecting transportation type, distance units, and specific route (when multiple routes are returned), as well as displaying route details.
Maps can provide directions for five different ways of “getting around” – driving, bicycling, walking, transit, and flight. You select one via the !3e# tag. The available values are:
1 = Bicycling
2 = Walking/Hiking
3 = Transit
4 = Flight
If this element is omitted, Maps will choose the fastest route(s) from among all transportation types. Only one can be selected, so (for example) it is not possible to look at only driving and transit routes while excluding bicycling, walking and flights.
The transportation type element is contained within the directions marker element, which is itself contained within the map/route/display contents element. So if your only data option was specifying transit routes, the data options section would look like:
The possible distance units are kilometers (km) and miles. By default, Maps will choose the one appropriate for the area you are getting directions in, so if you check the route from Edmonton to Ottawa in Canada you will see kilometers, but checking the route from Detroit to Chicago in the US will give you miles. The starting point is the controlling factor, so if you ask for directions from Detroit to Ottawa you will see miles, but if you reverse the route you will see kilometers.
To select one or the other, use the !4e# element, with a value of 0 indicating kilometers and 1 indicating miles.
This element is also under the two ‘4m’ elements, so if we ask for walking directions in miles, the data options section would look like:
Interesting note: if you select kilometers using the 4e0 element, Maps will delete the element from the URL after rendering the map. Changing the map from the web interface (other than changing the distance units) will maintain the use of kilometers, but if you update the URL without re-entering the 4e0 element, Maps will use the default units for the route requested.
If Maps returns more than one route for a directions request, the one to select can be specified via the !5i# element. The value is zero-based, so if Maps returns three route possibilities, they would correspond to values 0, 1, and 2 in whatever order of preference Maps uses.
So, if you only wanted driving routes and wanted the second route from the list to be selected, the data options section would look like:
If the specified route is out of range (for example, Maps only returned two routes but you used !5i2 to get the third one), Maps will “select” the first route but it will not be highlighted on the map display.
Route details are requested by using the /am=t tag. This causes the directions box on the left to display the section containing details of your route. However, this does not expand the various sections to reveal the turn-by-turn details automatically; you will need to do that manually.