Since the release of the new Google Maps API, there are some really powerful ways to create links from your site. These links could be a simple location, or they could be directions or even local searches. Here are some ideas of how to link to the New Google Maps.
There are multiple ways to link to the new Google Maps now, I will show a few different syntaxes to demonstrate alternate methods. The old method uses query strings, and is still supported, so I’ve showed them below, but the new method is listed first.
The most basic is a simple destination. This will link directly to an address. Here are two possible ways:
The following will link to an address and automatically focus the cursor on the starting location input. The user just types in where they are coming from and the directions are generated.
To add the traffic layer on any of these links, add this to the query string:
No user input is required as there is a starting and ending direction pre-propagated. Here are a few possible methods for doing so:
By simply including “Current Location” in the starting point input field, Google will detect the user’s location and automatically generate directions based on where they are right now. The string “My Location” can also work, but “Current Location” seems to have a higher success rate.
Note: As commenters have pointed out, translate “Current+Location” into your applicable language.
Instead of using an address, you could also include latitude and longitude coordinates for the destination (or starting point). In this example, we’re also using “Current Location” as the starting point.
Using the updated syntax, we can just keep adding destinations to the URL!
You could link to a search query of nearby places of an address or in this case coordinates. Change the “q=food” to whatever search you’d like. You can control the default zoom level with “,14z” or “&z=14 at the end of the URL (Zoom range is 0–19. 0 = Furthest Away, 19 = Closest In).
If you don’t know the address or GPS coordinates of the destination (or starting point for that matter), you could include a business name as the field instead and let Google determine what you mean. Obviously, you need to be careful with this one because it could serve a different location than you intend.
?layer=c will trigger Street View, but you’ll need to provide a latitude and longitude using the
&cbll= parameter. Here’s an example:
Note: This will only get you close unless you use one of the APIs to determine the
panoid you want. You used to be able to control the yaw, heading, zoom, and pitch with the
&cbp= parameter, but as far as I’ve researched these options are no longer available with simple URL parameters.