Archives » October 11th, 2005

October 11, 2005

Adding Google Maps to Your Own Site

For a couple of months now I’ve been adding restaurant listings to the Around Carson Dining Guide. I’ve got a database set up, and I just store the restaurant’s name, address, phone number, and maybe a picture and a PDF menu. From there the pages are built dynamically. But something else I’ve been keeping track of, even though I haven’t been using it, is the latitude and longitude of each restaurant, so the system can pinpoint exactly where the place is on the planet. I always had plans to use this data for something cool, but I didn’t do anything with it until yesterday.

Yesterday is when I finally sat down to learn how the Google Maps API works. Google Maps are some of the best maps out there on the web, and their API lets you include a map on your own page, set markers and text boxes, and just generally play around and have fun. So I dug into the API yesterday, and after running through a few of their example scripts, I realized it would be pretty simple to hook into my database, pull the lat/long data out, and plug it right into a Google Map. That’s just what I did, and that’s why if you visit any of the restaurant pages over there (like El Charro Avita, for example), you’ll see a Google Map embedded right there on the page, showing you exactly where the restaurant is. This is so so so much better than what you usually find on the web, which is just an address that links to a MapQuest page, or something else horrible like that. This is an actual, live, embedded map that you can scroll and zoom. And now that I know these maps are so easy to make, you’ll probably find them popping up all over the site. I’m already thinking of ways to make a map showing every restaurant in the city. It really isn’t that hard.

But it’s also a little too in-depth to get into on this site. If you want to learn how to do it, read through the same examples I did. They’re pretty easy to work through. It took me about an hour to learn how to build maps.

On the same topic, I discovered this week. It’s a wiki-style travel guide, where anyone can write or edit articles about the places they’ve visited, or where they live. But it also makes use of Google Maps to show restaurants and nightlife in a city. They even have a really cool interface where if a restaurant doesn’t have lat/long coordinates in their database, you can use an interactive Google Map to set them right in your browser. Talk about kick ass. If World66 takes off it could be a great travel guide. But of course I’m reluctant to add anything to it, because I want my site to be the premier travel guide for Carson City. So what if I’m biased?