Getting to Know Google Maps

If you've never heard of it, Google Maps is a free online mapping service made available by Google that is truly revolutionary in nature. What makes Google Maps so interesting is how it allows you to drag and zoom maps in real time, along with a seamless merger of vector map graphics and real satellite imagery. While all of these features are certainly impressive, the killer feature of Google Maps that has impressed most hardcore web users is its speed. If you've done much web development, you'll likely be amazed at how responsive Google Maps is to user input such as dragging and zooming maps. I know I was the first time I ever used it. The newness has admittedly worn off of Google Maps by now but the fun has really only just begun. In June of 2005, Google made available to the public an API (Application Programming Interface) for Google Maps that allows web developers to build custom mapping applications. Later in this tutorial you will build a custom mapping application. Before you get into that, however, it's important to get familiar with Google Maps and what all it has to offer.

You can visit Google Maps online at http://maps.google.com/. If you've never used Google Maps, I encourage you to follow that link now and start exploring the service.

When Google Maps first starts up, there is nothing particularly surprising about it since all you see is a map of the United States. But keep in mind that this is Google we're talking about, the masters of the search engine. Try entering a search in Google Maps to watch it come to life. For example, enter "pizza near Nashville" in the main search box and click the Search button (feel free to insert your hometown here). Figure 15.1 shows the resulting map after searching for pizza restaurants near Nashville, TN.

Figure 15.1. The search feature in Google Maps is surprisingly effective at finding places of interest.

Ah, now you're starting to see some of the power of Google Maps. Take things a step further by clicking one of the markers on the screen that represents the location of a pizza joint. Figure 15.2 shows how an information window appears that identifies the name of the location along with its address and a link to the restaurant on CitySearch.com.

Figure 15.2. Clicking a marker in Google Maps brings up an information window with details about the location.

By the way, if you're ever in Nashville, I highly recommend Pizza Perfect!

Keep in mind that at any point while using Google Maps you can click and drag the map or click on the zoom control in the upper-left corner of the map. Or maybe you want to see an actual satellite photo image of the map instead of vector map graphics. Just click the Satellite button in the upper-right corner of the map. More than likely you'll find the Hybrid view to be more useful than the Satellite view. The Hybrid view displays a satellite image with streets and street names overlaid, which makes most maps much easier to discern.

You can use the plus (+) and minus (-) keys on your keyboard as a shortcut for zooming in and out of a map, respectively.

Local search is another very handy feature of Google Maps that you won't want to overlook. While viewing any map on the screen, you can click Local Search and then perform a search on any piece of information. As an example, let's say you're planning on visiting Franklin, TN on business and you're interested in doing a little cycling on the Natchez Trace Parkway while you're in town. You've already been exploring the area in Google Maps but you don't know anything about area bicycle shops. Just enter "bicycle rental" as a local search and let Google Maps do the rest.

Figure 15.3 shows how a local search turns up numerous bicycle shops within a reasonable proximity to the original map location.

Figure 15.3. Performing a local search on Google Maps allows you to search for locations within the current map area in view.

Another interesting application Google has in the works is RideFinder, which is a real-time GPS-based system for tracking taxicabs using Google Maps. Using RideFinder, you can check for the nearest cab to your location and find yourself a ride home. RideFinder uses GPS transmitters that are placed in cabs to determine the locations of the cabs as they make their rounds. RideFinder is currently available for several major cities in the U.S. and is expected to continue expanding into new cities. To learn more about RideFinder, visit it on the Web at http://labs.google.com/ridefinder.

There are lots of other interesting features that Google Maps has to offer but at some point I have to bring my Google Maps love fest to a halt and get to the point of this lesson, which is how to use XML to customize Google Maps. However, I'd like to leave you with a few Google Mapsrelated links to explore as you learn more about the service and what all it can do:

  • Google Moon The Moon as viewed through Google Maps; make sure you zoom all the way in (http://moon.google.com/)

  • GeoBloggers Photographs that rely on Google Maps to show you where they were taken (http://www.geobloggers.com/)

  • Chicago Crime Locations of crimes committed in the Chicago metropolitan area (http://www.chicagocrime.org/)

  • Cheap Gas Locations of gas stations selling the cheapest gas (http://www.ahding.com/cheapgas/)

  • New York City Subway Locations of New York City subway stations (http://monkeyhomes.com/map/nycsubway.php)

  • GeoWorldNews World news with the location of each story marked (http://www.parsec.it/geoworldnews/)

  • Recent Earthquakes Locations of recent earthquakes (http://chimi.org/quake/index.html)

  • Urinal Dot Net Locations of public urinals around the United States (http://urinal.net/google_map.html)

  • Google Maps Directory Directory of Google Maps applications (http://www.gmdir.com/)

In addition to some of the interesting Google applications that have been created, there are also some interesting finds that people have made while using Google Maps. For example, one astute Google Maps user spotted a building suspiciously shaped like a swastika (http://maps.google.com/maps?q = san + diego&ll = 32.676505, -117.157559&spn = 0.004739, 0.009917&t = k&hl = en) and therefore deemed it a potential hideout for Adolf Hitler. Another person spotted a pattern on a Peruvian sand dune that some say resembles the face of Jesus. . . or Charles Manson (http://maps.google.com/maps?ll = -16.337013, -71.959763&spn = 0.110893, 0.158186&t = k&hl = en). I'm not making this stuff up!

In this list, I've provided plenty of interesting sites to keep you busy for the remainder of this tutorial but if you can tear yourself away from Google Maps for just a moment, it's time to dig into the details of what it takes to customize Google Maps to create your own mapping application.