How do I include a link to driving directions in an embedded Google Map?
June 29, 2007 2:55 PM   Subscribe

What is the best way to embed a Google Map of a business's location, including a link to driving directions?

This is for a small business's website. All I want is a small embedded map of the business's location, with a standard pop-up flag including links for driving directions, the address, etc. (Basically like what you see here, but without the extra search results on the left-hand side.

If there's a better input method for requesting driving directions, that would be fine too.

I would think that providing a map & driving directions to a specific business would be one of the most common uses of the Google Maps API, but I don't see any examples of what I'm looking for. Surely, there must be a simple, standard way to provide driving directions on your website… Right?
posted by designbot to Computers & Internet (9 answers total) 2 users marked this as a favorite
Here's an example of using driving directions with the Google Maps API.

You could simply hard code the "To" address ("Mountain View" in their example) and your users would be able to enter their own address.
posted by null terminated at 3:14 PM on June 29, 2007

You could hard code it within an iframe [somewhat self link]. Not the prettiest method, but oh-so-simple.
posted by niles at 4:29 PM on June 29, 2007

...which is actually kinda what you link to, so may not work for you.
posted by niles at 4:29 PM on June 29, 2007

I recommend

Create the map just the way you like it.. then click on the "Share/Export" tab and copy the code to your own website.

Pretty dead simple.
posted by jmnugent at 6:40 PM on June 29, 2007

Um, so I'm confused. I guess I have one of two answers:
1) If all you want is a map on your own site showing "here's where we are!" then why not just do a print-screen of that map, slap it into mspaint and save it as a .jpg and host that? It does not need to be an embeddable interactive map, does it?

2) If you want interactivity- showing a mapping app on your site that can provide directions to your store from wherever the customer says they're starting from- then why assume that Google is your only option?

I'm horribly biased, but I've always felt that MSN's virtualearth is a vastly better mapping program than Google's- it's slicker, was way ahead of google on some nice interactivity and usability features (bird's eye view, scroll wheel support, permalinks which included the ability to permalink pushpins and notes- great for making walking tours, etc, etc), and has a great SDK- which, oh by the way, supports driving directions and customizable layout thereof.
posted by hincandenza at 11:12 PM on June 29, 2007

Google Maps API is for developers. For your extremely modest needs, it's overkill. Not to mention painful. Just use Google My Maps. It takes longer to read their instructions than it does to actually create the map, make it public, and paste the link into your webpage. Dead simple.
posted by nakedcodemonkey at 11:43 PM on June 29, 2007

Response by poster: Thanks for the answers so far. I'm still not really seeing anything as straightforward as I had hoped for.

null terminated: That option will require more code tweaking than I was hoping for, and doesn't give you any decent printing options.

niles: That's functional, but I can't bring myself to have the full Google toolbar across the top of an embedded frame.

jmnugent: That might work. I'll have to look at it further. I don't like the embedded ads or the Community Walk banner.

hicandenza: I want a map that includes a link for driving directions. Interactivity would be a bonus. I might just have to fake this myself. Your MSN SDK link comes up as an almost-blank page in Safari, so I don't think that's going to work for me.

nakedcodemonkey: I don't see a way to do this with My Maps. I don't even see an embedding option.
posted by designbot at 2:20 PM on July 2, 2007

Best answer: For future reference, I discovered by accident that Google Maps has a brand-new feature that does exactly this, without going through the API at all.

Now, when you click on "Link to this page" from a Google map, it gives you a customizable snippet of HTML to paste into your own webpage. It works great!
posted by designbot at 10:44 AM on August 24, 2007

« Older I think I am going to pay alimony -- what am I...   |   How to play piano again Newer »
This thread is closed to new comments.