Hack 44. You Got Your A9 Local in My Google Maps!

Use Greasemonkey to inject A9's Local Images into Google's much nicer map interface.

A9.com, Amazon's search company, has special trucks equipped with digital cameras and GPS units that run around selected cities. The trucks take street-level pictures of just about everything and then index that with the GPS and a geocoding application to add photographs to business listings. A9.com "brings Yellow Pages to life." Figure 5-13 shows the A9 Block View of the City Lights bookstore in San Francisco.

A9.com is pretty neat, but the mapping interface is a bit weak. If you have the Greasemonkey extension installed in the Firefox browser, you can install A9+Gmaps, a Greasemonkey user script that will load A9 images on top of your Google Maps.

Installing Greasemonkey in Firefox is covered in detail in "Add Google Maps to Any Web Site" [Hack #27] and "Track Your UPS Packages" [Hack #25].

Figure 5-13. City Lights bookstore, according to A9.com

Once Greasemonkey has been installed in Firefox, you can get A9+Gmaps from http://www.kokogiak.com/webtools/greasemonkey/a9imagesingooglemaps.html. From that page, right-click on the link to a9gmap.user.js and select Install User Script. An installation window will pop up, as depicted in Figure 5-14.

Click on OK, and with a bit of luck you'll get a status window that says "Success! Refresh page to see changes." Now, when you search for a business on the Google Maps web site in an area covered by A9 Local, you'll be able to click on the icon and, a few seconds later, an A9 thumbnail will appear in your info window.

The A9+Gmaps Greasemonkey script is executed whenever a user is on a page in the maps.google.com domain. When the user clicks on an icon in the map, the script finds the newly opened info balloon and parses the HTML inside it to find the business name and address, if present. The script then sends that data out to A9.com, behind the scenes. When A9.com responds, the script parses A9's HTML to discover an image (if one exists), and gets the location and URL of the A9.com image and page. Finally, the script inserts a thumbnail image of that location into the Google Maps info window.

One caveat: this hack is largely based on screen-scraping and picking apart the respective Document Object Models on both sites. That means it's fragile and easily broken if either A9 or Google alter too much HTML layout. In the meantime, mashing up A9's street level photos with Google's map interface means that finding businesses and other locations is easier than ever.

Figure 5-14. Installing a user script under Greasemonkey

Alan Taylor






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

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