New Google Maps URLs – Directions Options (Part 2)

In this second post on URL options for Google Maps directions, we will look at specifying waypoints – locations which Maps will require a route to pass through – for both simple and multi-stop directions.

Let’s look at a simple set of directions – driving from Estes Park Resort in Estes Park, CO down to the Colorado School of Mines in Golden, CO. A simple URL for this would be:

Now, suppose you’ve never seen the Central City/Black Hawk casinos, so you decide to go a bit out of your way to drive past them on the way down. You select 39.80165,-105.49442 (the middle of the street between the casinos) as your waypoint. The resulting URL would look like this:!4m6!4m5!1m4!3m3!1m2!1d-105.49442!2d39.80165

The data options become a little easier to read if we break that section down:

!4m6 – Map/route/display contents, 6 elements
   +-!4m5 – Directions options, 5 elements
        +-!1m4 – Leg of route, 4 elements
             +-!3m3 – Waypoint, 3 elements
                  +-!1m2 – Waypoint location, 2 elements
                       +-!1d-105.49442 – Longitude
                       +-!2d39.80165 – Latitude

If you check back on the Data Options Reference page you will see that there are many elements that we have omitted, but Maps can supply them automatically so we don’t have to worry about them.

Now, suppose we are going to stop at the Gates Camp in Ward, CO first before continuing on to Golden via Central City. Our revised URL will look like:,Ward,CO/CO+School+of+Mines/data=!4m7!4m6!1m0!1m4!3m3!1m2!1d-105.49442!2d39.80165

Breaking down the data options section:

!4m7 – Map/route/display contents, 7 elements
   +-!4m6 – Directions options, 6 elements
        +-!1m0 – Leg of route, no elements
        +-!1m4 – Leg of route, 4 elements
             +-!3m3 – Waypoint, 3 elements
                  +-!1m2 – Waypoint location, 2 elements
                       +-!1d-105.49442 – Longitude
                       +-!2d39.80165 – Latitude

Note that we have an empty !1m element for the first leg. If we did not include that, Maps would treat our waypoint as belonging to the first leg of the route, resulting in a very different set of directions.

You can specify waypoints on more than one leg, as well as multiple waypoints within the same leg. So, let’s say you decide that on your way out of Estes Park you’re going to swing past Solitude Cabins to see if it looks like a nice place to stay for your next visit; you pick 40.36852,-105.49161 (the middle of Sketch Box Lane) as your waypoint. Then, after driving past the casinos, you want to swing through Idaho Springs and get on I-70 there to head back towards Golden; you use the I-70 on-ramp (39.74052,-105.51960) as your waypoint. Now we have the following URL:,Ward,CO/CO+School+of+Mines/data=!4m15!4m14!1m4!3m3!1m2!1d-105.49161!2d40.36852!1m8!3m3!1m2!1d-105.49442!2d39.80165!3m3!1m2!1d-105.51960!2d39.74052

Breaking down the data options section:

!4m15 – Map/route/display contents, 15 elements
   +-!4m14 – Directions options, 14 elements
        +-!1m4 – First leg of route, 4 elements
        |    |
        |    +-!3m3 – Waypoint, 3 elements
        |         |
        |         +-!1m2 – Waypoint location, 2 elements
        |              |
        |              +-!1d-105.49161 – Longitude
        |              +-!2d40.36852 – Latitude
        +-!1m8 – Second leg of route, 8 elements
             +-!3m3 – First waypoint, 3 elements
             |    |
             |    +-!1m2 – Waypoint location, 2 elements
             |         |
             |         +-!1d-105.49442 – Longitude
             |         +-!2d39.80165 – Latitude
             +-!3m3 – Second waypoint, 3 elements
                  +-!1m2 – Waypoint location, 2 elements
                       +-!1d-105.51960 – Longitude
                       +-!2d39.74052 – Latitude

Return to New Google Maps URLs introduction

Posted in Google Maps, Online Maps | Tagged , | Leave a comment

New Google Maps URLs – Directions Options (Part 1)

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:

0 = Driving
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.

Return to New Google Maps URLs introduction

Posted in Google Maps, Online Maps | Tagged , | Leave a comment

New Google Maps URLs – Map Appearance Options

This post will cover two options dealing with map appearance: image type and map layers.

There are two image types possible for regular maps – street map and satellite imagery. In the Maps interface, these are controlled by a clickable box in the lower left which will say either “Satellite” or “Map” (it always shows the opposite of what is currently displayed). Technically, what Maps currently calls “Satellite” is more like Classic Maps’ “Hybrid” view, in that both satellite imagery and street map symbols are displayed; there does not appear to be any way to get a pure satellite image without map symbols.

Map view is set using option !3m1!1e0, although since this is the default setting it can be omitted. Satellite view is set using option !3m1!1e3. Multiple options are not possible; if you tried using !3m2!1e0!1e3 or !3m1!1e0!3m1!1e3, Maps would only apply the last one specified.

There are six different map layers that I have identified – traffic, transit, bicycling, terrain, images, and flights.

Layers are specified using the following format:


The layer values are:

1 = Traffic (real time)
2 = Transit (i.e., bus lines, light rail, etc)
3 = Bicycling (i.e., bike paths)
4 = Terrain
5 = Images (i.e., where Street View is available)
6 = Flights

So, if you wished to specify the terrain and traffic layers, the option set could look like:


Note that not all layers are compatible with each other. Traffic is not compatible with bicycling, transit, or images, and bicycling is also not compatible with transit or flights. If you specify a set of layers that includes one or more incompatibilities, Maps will resolve these from last to first, like this:


!1e3 is Bicycling – included
!1e1 is Traffic – incompatible with Bicycling; omitted
!1e2 is Transit – incompatible with Bicycling; omitted
!1e4 is Terrain – compatible with Bicycling; included

If multiple layers are specified in the URL, after resolving incompatibilities and rendering what it can, Maps will alter the URL to only include one layer (specifically, the last layer in the list which is not the Images layer) and will display the box on the left side which includes the options or notes for that layer.

There are two exceptions to the above rules that I have noticed.

  1. If the Bicycling and Flights layers are both specified, then even if the Bicycling layer comes after the Flights layer in the URL, Maps will not display the Bicycling layer. However, the layer box will still display the Bicycling layer information if that layer was last in the URL.
  2. If the Images layer is specified anywhere in the URL list and is not omitted due to compatibility rules, the layer box will show the Images layer information.

A few final notes:

  • The Flights layer currently does not appear to display any flight-related information. It might need to be associated with personal flight information from the user’s Google+ account, or perhaps it is functionality that is under development; I just don’t know.
  • Transit will display transit routes but only in limited areas; apparently not much transit information is available in the Google Maps system at this time.
  • There is apparently no way to specify a day and time for the Traffic layer; only live traffic is available via the URL. You can, of course, select “Typical Traffic” in the Maps interface, but if you had more than one layer up the non-traffic layer(s) will be lost when you do this.

Return to New Google Maps URLs introduction

Posted in Google Maps, Online Maps | Tagged , | Leave a comment

New Google Maps URLs – Data Options Reference

Maps’ data options are located following the term /data= in the URL. The options section is made up of one or more elements, each of which have the following general format:

  • An exclamation point (!) as the first character
  • An index number which indicates what this element represents (meaning is context-sensitive).
  • A letter indicating the data type
  • The value of the element.

The following data types have been observed:

  • b – Binary (0 = off/no, 1 = on/yes)
  • d – Decimal (value is a decimal – i.e., floating-point – number)
  • e – Enumerated (0 = 1st option, 1 = 2nd option, etc.)
  • i – Integer (value is a numeric integer)
  • j – Julian Date? (value is an integer indicating the number of seconds since the start of Jan 1, 1970)
  • m – Marker? (marks the start of a collection of elements; value is an integer indicating the number of following elements “contained” by this one)
  • s – String (value is a text string, possibly an encoding of some sort)

The following data elements have been observed (some identifications are tentative, or just educated guesses):

  • 3m   Type of map/display
    • 1e   Type of map/display
      • 1e0 = Street Map
      • 1e1 = Street View or See Inside
      • 1e2 = User Photos
      • 1e3 = Satellite
    • 3m   Photo/image information
      • 1s   Unknown
      • 2e   Unknown
      • 3e   Unknown
      • 6s   URL of the photo/image content
      • 7i   Uncertain, possibly image width in pixels
      • 8i   Uncertain, possibly image height in pixels
    • 4b   Uncertain. Maps occasionally inserts this as a ‘!3m1!4b1’ block. When used with a place request, including it seems to override the MAP_POSITION section and zoom in on the requested place.
  • 4m   Map/route/display contents
    • 3m   Unknown (appears to be related to Street View)
      • 1s   Unknown
    • 4m   Directions
      • 1m   Stop along the route
        • 1m   Stop stored details
          • 1s   Encoded string
        • 2m   Stop stored location
          • 1d   Longitude (decimal degrees)
          • 2d   Latitude (decimal degrees)
        • 3m   Waypoint encountered after this stop
          • 1m   Waypoint location
            • 1d   Longitude (decimal degrees)
            • 2d   Latitude (decimal degrees)
          • 3s   Waypoint stored details (encoded string)
      • 2m   Route options
        • 1b   Avoid highways
        • 2b   Avoid tolls
        • 3b   Avoid ferries
        • 4e   Preferred transit criterion (mutually exclusive; uses final one)
          • 4e0, 4e1 = Prefer best route (i.e., fastest time) (default); not sure what the difference is, or if there even is one
          • 4e2 = Prefer fewest transfers
          • 4e3 = Prefer less walking
        • 5e   Preferred transit type (multiple OK)
          • 5e0 = Bus
          • 5e1 = Subway
          • 5e2 = Train
          • 5e3 = Tram/light rail
          • Omitted = Any
        • 6e   Designate arrival/departure time (mutually exclusive; uses final one). Appears to have no effect without the 8j element.
          • 6e0 = Depart at (default)
          • 6e1 = Arrive by
          • Omitted = Do not use arrival/departure time
        • 7e   Uncertain. Appears to have no effect without 8j element. If omitted, arrival/departure time used is four hours before the specified time.
          • 7e2 = Only value that appears to allow arrival/departure time to work properly
        • 8j   Arrival/departure time specification.
      • 3e   Type of transportation to use (mutually exclusive; uses final one)
        • 3e0 = Driving (car)
        • 3e1 = Bicycling
        • 3e2 = Walking/Hiking
        • 3e3 = Transit
        • 3e4 = Flight
        • Omitted = Any
      • 4e   Distance units to use (mutually exclusive; uses final one)
        • 4e0 = Kilometers
        • 4e1 = Miles
        • Omitted = Automatic (default for that area)
      • 5i   Route to select (mutually exclusive; uses final one). Zero-based integer index, so ‘5i0’ means select the first route, ‘5i1’ the second, etc. If the value is higher than the number of routes returned, the first route will be “selected” but not highlighted on the map.
  • 5m   Map layers
    • 1e   Type of layer (multiple OK; in conflicts, priority goes to last listed)
      • 1e1 = Traffic
      • 1e2 = Transit
      • 1e3 = Bicycling
      • 1e4 = Terrain
      • 1e5 = Images (Street View, Photo Spheres, See Inside)
      • 1e6 = Flight
  • 6m   Unknown
    • 1e   Unknown. There always seems to be a ‘!6m1!1e1’ at the end of Street View and User Photo URLs.

How these elements are used to customize Maps will be covered in subsequent posts.

Return to New Google Maps URLs introduction

Posted in Google Maps, Online Maps | Tagged , | 4 Comments

New Google Maps URLs – Latitude/Longitude in Requests

While the MAP_POSITION section must be formatted in decimal degrees, latitudes and longitudes used in place requests and directions have a lot more leeway in their formatting. For example, suppose we want to specify the point 40°07’30″N, 107°23’06″W. Some of the ways just the longitude portion can be expressed are:


The latitude and longitude directions (N/S and E/W) have to be expressed the same way, but the numeric values don’t. So while this works fine:


This does not:


Also, Maps must be able to separate latitude from longitude. In the Western hemisphere this is not a problem, since even if the comma separator is not used, you will either have a N/S letter for latitude or a negative sign to start the longitude. In the eastern hemisphere, however, you must avoid an ambiguous location like this:

40 12 32 16

Maps cannot tell which of the following that was supposed to be:

40°12’N, 32°16’E
40°12’32″N, 16°E
40°N, 12°32’16″E

Anything that allows Maps to figure out where the separation point is will fix this; for example, all of these will work:

40 12, 32 16
40 12 N 32 16 E
40 12.0 32 16
40 12 32° 16
40 12 32 16′

However, unlike with MAP_POSITION, Maps will not be very forgiving with out-of-range values. For example, the following lat/lon:


would be corrected to 40.125,-107.385 if used as part of a MAP_POSITION, but as a place request or directions stop it is not understood (in fact, when I tried it in directions, for some reason Maps placed that point in the North Atlantic Ocean rather than rural Colorado).

Return to New Google Maps URLs introduction

Posted in Google Maps, Online Maps | Tagged , | Leave a comment

New Google Maps URLs – Display Requests

In this post we’ll discuss the various types of DISPLAY_REQUESTplace, search, and directions requests.

Both place requests and search requests consist of their keyword followed by a slash and the description of the request:


While both types are asking for map locations, place requests look for a single location while search requests look for all matching locations. As an example from my testing:,+PA

centered the map just south-west of the Fort Pitt Tunnel and displayed numerous markers for area hotels. However,,+PA

zoomed in on and marked only the Clarion Hotel and Conference Center in Green Tree. Changing ‘hotels’ to ‘hotel’ does not change the results. I am not sure what criteria Maps uses to determine which potentially matching location is returned.

If a search is performed for a very specific location, Maps will normally return the result as if the place keyword had been used instead (and will update the displayed URL accordingly). If a generic search term is used such as ‘hotel’, ‘restaurant’, etc., Maps will conduct its search in/near the place specified in the search or place description, or if no search location is specified it will use the default map area. Maps does not appear to distinguish between terms like ‘near’, ‘in’, ‘by’, and the like (and they can be omitted without effect). Compass directions will be treated not as directions but as place names, so asking for ‘hotels+West+of+Pittsburgh’ is likely instead to find hotels near West Homestead in the Pittsburgh area (as in my test).

Some of the common place description types are:

Full address:
City, town, municipality, county, nation, etc.:
Zip/postal codes:
Parks, landmarks, historical sites:
Businesses, schools, museums, etc.:
Prominent geographical features:
Latitude/longitude coordinates:
See the post on Latitude/Longitude in Requests

Almost any term that works as a place description can be used as the place for a search (whether with the search or place keywords). However, latitude/longitude places did not work as searches in my testing; they needed to be specified in the MAP_POSITION element instead.

Unlike search and place requests, a directions request is followed by multiple terms – an origin and destination at a minimum, and potentially other intermediate estops as well:


The ORIGIN, DESTINATION, and intermediate stops can be anything that would work as a place description for a place or search request. Additionally, as long as Maps can identify either the ORIGIN or DESTINATION as a specific place, it will be very aggressive in interpreting any other specified stops:

This returns a result
This does not

The Maps interface will only allow you to enter ten stops (starting point, eight intermediate stops, and destination), but you can successfully enter up to 24 stops via the URL. However, unless you have a tall monitor you will probably not be able to access the details without using the ‘/am=t’ option. Adding a 25th stop will return directions, but in my testing the map itself would not load. With 26 or more stops no directions are returned and a default map is displayed.

Return to New Google Maps URLs introduction

Posted in Google Maps, Online Maps | Tagged , | Leave a comment

New Google Maps URLs – Map Positioning

When viewing a simple map (including those with place, search, or directions requests), the MAP_POSITION section is used to center the map and specify the desired zoom level. If no MAP_POSITION is specified, Maps will position the map based on the DISPLAY_REQUEST if one was specified; otherwise it will use a default location (which appears to be the user’s location, to the degree Maps can determine it).

Maps will preferentially use MAP_POSITION to center and zoom the map, even if this causes the requested place or directions to be “off-map”. Also, if a search is done with the search term specifying one location while MAP_POSITION specifies another, the map will display the results of the search in the MAP_POSITION area while the dropdown box on the left shows results from the search-specified area.

The format used for MAP_POSITION is:

Example (Gateway Arch, St. Louis):

LATITUDE is expressed in decimal degrees. The map can extend from -85° to +85°, so the specified latitude cannot be a value which would cause the map to display outside that range (what that value is will depend on the zoom level and the map height). If the URL specifies a latitude outside the allowable range, Maps will move it the smallest distance towards zero necessary to make it valid.

LONGITUDE is also expressed in decimal degrees. The map extends from -180° to +180° and wraps around; if longitude is set to a value less than -180° or greater than 180°, Maps will convert it to the equivalent angle within that range (i.e., 350.2 would become -9.8).

ZOOM can be expressed either as a zoom “level”, or as the distance in meters represented by the vertical extent of the map (i.e., the distance from map bottom to map top). Zoom level is indicated by the letter ‘z’; distance in meters by the letter ‘m’.

According to my testing, zoom levels can range from 3z (maximum zoom-out) to 21z (maximum zoom-in). A level greater than 21 is treated as 21; a level less than 3 but greater than 0 is treated as 3. A level which is 0 or negative causes the position section to be ignored. A fractional level between 3 and 21 is truncated unless it is within about 0.05 of the next higher level, in which case it is rounded up. Classic Maps would allow higher zoom levels in certain areas, but my tests of a couple of these areas in new Maps shows a maximum zoom of 21.

Distances will always get rounded to the appropriate distance for a given zoom level. So, for example, if 12z is equivalent to 26211m and 11z is equivalent to 52422m, you can’t use 37068m to get the equivalent of 11.5z; it will automatically get rounded out to 52422m/11z. However, if the distance were within about 3.53% of the lower value, it would get rounded down (in this example, 27135m would round in to 26211m/12z, but 27136m would round out to 52422m/11z).

By default, Maps uses zoom levels for street maps and distance in meters for satellite view, but the URL will accept either form for either type of map.

When viewing a Street View image, the MAP_POSITION section has a different format:

Example (Top of Gateway Arch viewed from Leonor K Sullivan Blvd):

LATITUDE and LONGITUDE are the same as described above for simple maps.

3a just is. I have never seen anything else here, and when I’ve attempted to use other values they have either caused problems or been changed back to ‘3a’ by Maps.

FOCUS is like a zoom level. It can range from a maximum zoom-in of 15y to a maximum zoom-out of 90y; Street View normally starts at 75y. While the map controls will set this in multiples of 15, any value between 15 and 90 can be set in the URL and it will only be rounded to the nearest 0.1 (so, 15.5y zooms out just a touch compared to 15y). Setting the value outside the range of 0-180 produces an “invalid” image; 0-15 is treated as 15 and 90-180 is treated as 90. I do not know what the numbers represent specifically.

DIRECTION is the compass direction in degrees that the camera viewpoint is pointing in. 0 is North, 90 is East, and so on. Values are rounded to the nearest 0.01 degrees. Setting the value outside the range 0-360 produces an invalid image.

ANGLE is the elevation angle of the camera. 0 is pointing straight down, 180 is pointing straight up. Values are rounded to the nearest 0.01 degrees. Setting the value outside the range 0-180 produces an invalid image.

Return to New Google Maps URLs introduction

Posted in Google Maps, Online Maps | Tagged , | Leave a comment