Hack 6. Share Google Maps

Found something good? Email a link, bookmark it, or post it on your web site.

Are you having a party and needing to let people know where it will be held? Did you find a cool spot that you want to show your friends? Google Maps can create an email with a link that will show your friends (mostly) the same view you seeor generate a link to post on your own web site.

Without maps, many of us are reduced to near-incomprehensible grunts if forced to provide directions to our homes. Even if we've lived in the same place for years, our direction-giving process too often includes putting a hand over the phone handset and asking whoever is around, "What is the name of that street?"

The problem doesn't end there. Even if we are good at providing directions, our would-be visitor must keep track of fragments of data such as "the red mailbox" and "right after the hilland if you hit the corner, you've gone too far." With online map services, though, most of the time it is enough just to have a street address, and with most, emailing or posting a link to a map helps a visitor find the location quickly.

Figure 1-20 shows driving directions from W 88th St and Broadway, NY, NY to W 92nd St and Central Park West, NY, NY. It also includes a destination mini-map.

Figure 1-20. Getting around New York in Google Maps

Click the Email link just under the line that includes the Map and Satellite links, and Google opens your email client and inserts this link to this map, along with a set of driving directions, in the body of the email:



All you need to do is fill in the email address of your friend and send it off.

1.7.1. Bookmark a Google Map or Post It on Your Web Page

Google Maps makes deep use of JavaScript to dynamically redraw the map without (apparent) requests to the server. This means that the location bar in your browser does not get updated. This only becomes an issue when you decide to bookmark a map to use later.

When you bookmark Google Maps, you find that you've bookmarked the overview map of the whole United Statesalmost certainly not what you intended! Fortunately Google has provided a way out. Next to the Email link, under the Map and Satellite links, is a link to "Link to this page," as shown in Figure 1-21.

Figure 1-21. Print, email, or link to this map

Clicking "Link to this page" updates the address bar in your browser. Now you can bookmark the page in your browser or share the link on del.icio.us [Hack #9]or copy the link from the address bar and paste it into your own web page. alternatively, you can right-click on "Link to this page" and select Copy Link Location (in Firefox) or Copy Shortcut (in Internet Explorer) to copy the link directly to the clipboard.

To post a link on your web page:

  1. Find a map that you like.
  2. Right-click on "Link to this page" and select the Copy option.
  3. Paste the link into your web page within an appropriate anchor tag.

For example, here is a link to a map of Salina, Kansas: http://maps.google.com/maps?q=Salina,+KS&spn=0.124512,0.215467&hl=en.

You could include it in your web page with this HTML:

	<a href="http://maps.google.com/maps?q=Salina,+KS&spn
	 =0.124512,0.215467&hl=en">Salina, Kansas</a>


1.7.2. Shorten That Link!

Sometimes, if you just want to paste a URL of a Google Map into an email, you may find that the URLs are just long enough to break in the middle and wrap to the next line in your email client, which may make it more difficult for the recipients of your email to use. Metamark offers a solution to this problem at http://xrl.us/. There you'll findno kiddinga link-shortening service, which takes unwieldy URLs like those produced by Google Maps and generates a permanent redirect from a much shorter URL to the much longer one you're having trouble with. Here, for example, is Metamark's shortened version of the Central Park driving directions that were shown in Figure 1-20:


When others visit the shortened URL, their browsers will immediately be redirected to the longer URL you started with. You can also choose to use a mnemonic "nickname" in place of the string of random letters after xrl.us in the shortened URL, as well as apply a password to keep your URL under wraps.

1.7.3. Limits on Email and Links

The link generated by Email and "Link to this page" produces almost the same view when clicked as you have when you create the links. Sometimes the map is not centered in the same place as when you clicked on the link, as browser window sizes vary, and Google Maps does its best to show the area requested. Occasionally, this may even result in a different zoom level being displayed, in order to make the requested area fit in the available browser window space.

Also, it is quite possible, since Google Local searches appear to be regenerated on demand, that someone using your link could see a slightly different list of businesses than you did when you created the link.

Currently, the link does not save embedded mini-maps, so if you've created driving directions and opened up a mini-map at the start or end address, it will not be included in the email or link that you generate.

Maps help us gather together, and being able to communicate with more precision than "drive past the third gate, then turn right" means more people will show up where they want to be, rather than lost by a frog pond (though searching for "lost by a frog pond" brings up an absurd number of links).

You Are Here: Introducing Google Maps

Introducing the Google Maps API

Mashing Up Google Maps

On the Road with Google Maps

Google Maps in Words and Pictures

API Tips and Tricks

Extreme Google Maps Hacks

Google Maps Hacks
Google Maps Hacks: Tips & Tools for Geographic Searching and Remixing
ISBN: 0596101619
EAN: 2147483647
Year: N/A
Pages: 131

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net