You are previewing Google Maps Hacks.
O'Reilly logo
Google Maps Hacks

Book Description

Want to find every pizza place within a 15-mile radius? Where thedog parks are in a new town? The most central meeting place foryour class, club or group of friends? The cheapest gas stations ona day-to-day basis? The location of convicted sex offenders in anarea to which you may be considering moving? The applications,serendipitous and serious, seem to be infinite, as developers findever more creative ways to add to and customize the satelliteimages and underlying API of Google Maps.

Written by Schuyler Erle and Rich Gibson, authors of the popularMapping Hacks, Google Maps Hacks shares dozens oftricks for combining the capabilities of Google Maps with your owndatasets. Such diverse information as apartment listings, crimereporting or flight routes can be integrated with Google'ssatellite imagery in creative ways, to yield new and usefulapplications.

The authors begin with a complete introduction to the "standard"features of Google Maps. The adventure continues with 60 useful andinteresting mapping projects that demonstrate ways developers haveadded their own features to the maps. After that's given you ideasof your own, you learn to apply the techniques and tools to addyour own data to customize and manipulate Google Maps. Even Googleseems to be tacitly blessing what might be seen as unauthorizeduse, but maybe they just know a good thing when they see one.

With the tricks and techniques you'll learn from Google MapsHacks, you'll be able to adapt Google's satellite map featureto create interactive maps for personal and commercial applicationsfor businesses ranging from real estate to package delivery to homeservices, transportation and more. Includes a foreword by GoogleMaps tech leads, Jens and Lars Rasmussen.

Table of Contents

  1. Dedication
  2. Special Upgrade Offer
  3. Foreword
  4. Credits
    1. About the Authors
    2. Contributors
  5. Preface
    1. Putting the World in the World Wide Web
      1. Open APIs + Open Data Formats = Web 2.0 Heaven
      2. Who Will Aggregate the Aggregators?
      3. Not Just Where 2.0, But Also Why 2.0
    2. Why Google Maps Hacks?
    3. How to Use This Book
    4. How This Book Is Organized
    5. Conventions Used in This Book
    6. Using Code Examples
    7. How to Contact Us
    8. Got a Hack?
    9. Safari Enabled
  6. 1. You Are Here: Introducing Google Maps
    1. 1.1. Hacks 1–9: Introduction
    2. 1. Get Around
      1. 1.2.1. What’s Different About Google Maps?
      2. 1.2.2. Getting Around
      3. 1.2.3. Entering a Location
    3. 2. Find Yourself (and Others) on Google Maps
      1. 1.3.1. Odd and Surprising Ways to Find Things
      2. 1.3.2. When Locations Fail: The Importance of Context
    4. 3. Navigate the World in Your Web Browser
      1. 1.4.1. Just a Click Away…
      2. 1.4.2. You Control the Horizontal and the Vertical
      3. 1.4.3. Economies of Scale
      4. 1.4.4. Take the Shortcut
      5. 1.4.5. Taste the Secret Sauce
    5. 4. Get the Bird’s-Eye View
      1. 1.5.1. Is It Really There?
      2. 1.5.2. Hybrid Vigor
    6. 5. Driven to a Better User Interface
      1. 1.6.1. Using the Info Windows
      2. 1.6.2. Other Ways to Search
    7. 6. Share Google Maps
      1. 1.7.1. Bookmark a Google Map or Post It on Your Web Page
      2. 1.7.2. Shorten That Link!
      3. 1.7.3. Limits on Email and Links
    8. 7. Inside Google Maps URLs
      1. 1.8.1. More Parameters!
      2. 1.8.2. Finding More Parameters?
      3. 1.8.3. See Also
    9. 8. Generate Links to Google Maps in a Spreadsheet
      1. 1.9.1. See Also
    10. 9. Use del.icio.us to Keep Up with Google Maps
      1. 1.10.1. See Also
  7. 2. Introducing the Google Maps API
    1. 2.1. Hacks 10–16: Introduction
    2. 10. Add a Google Map to Your Web Site
      1. 2.2.1. Get a Developer Key
      2. 2.2.2. Hello, World!
      3. 2.2.3. Getting Outside of Your Head
      4. 2.2.4. Getting Right to the Point
      5. 2.2.5. See Also
    3. 11. Where Did the User Click?
    4. 12. How Far Is That? Go Beyond Driving Directions
    5. 13. Create a Route with a Click (or Two)
      1. 2.5.1. The Code
    6. 14. Create Custom Map Markers
      1. 2.6.1. Find the Right Foreground Image
      2. 2.6.2. Casting the Shadow
      3. 2.6.3. Add Your New Icon to a Map
      4. 2.6.4. See Also
    7. 15. Map a Slideshow of Your Travels
      1. 2.7.1. The Code
      2. 2.7.2. See Also
    8. 16. How Big Is the World?
      1. 2.8.1. Economies of Scale
      2. 2.8.2. So, How Much?
      3. 2.8.3. What About the Rest of the World?
  8. 3. Mashing Up Google Maps
    1. 3.1. Hacks 17–28: Introduction
    2. 17. Map the News
    3. 18. Examine Patterns of Criminal Activity
      1. 3.3.1. Adding Ward and ZIP Code Boundaries
      2. 3.3.2. See Also
    4. 19. Map Local Weather Conditions
      1. 3.4.1. The Situation Outside Is…
      2. 3.4.2. More Than Just the Weather
      3. 3.4.3. Microclimates and Distributed Weather Reporting
      4. 3.4.4. See Also
    5. 20. Track Official Storm Reporting
      1. 3.5.1. Getting the Data
      2. 3.5.2. The Hack
      3. 3.5.3. See Also
    6. 21. Track the International Space Station
      1. 3.6.1. How It Works
      2. 3.6.2. See Also
    7. 22. Witness the Effects of a Nuclear Explosion
      1. 3.7.1. The Code
      2. 3.7.2. See Also
    8. 23. Find a Place to Live
      1. 3.8.1. What to Do?
      2. 3.8.2. How It Works
      3. 3.8.3. See Also
    9. 24. Search for Events by Location
      1. 3.9.1. How It Works
      2. 3.9.2. See Also
    10. 25. Track Your UPS Packages
      1. 3.10.1. The Hack
      2. 3.10.2. The Code
      3. 3.10.3. Hacking the Hack
    11. 26. Follow Your Packets Across the Internet
      1. 3.11.1. From Clicks to Bricks
      2. 3.11.2. How It Works
      3. 3.11.3. Hacking the Hack
    12. 27. Add Google Maps to Any Web Site
      1. 3.12.1. Greasemap to the Rescue
      2. 3.12.2. Installing Greasemap
      3. 3.12.3. Taking Greasemap Out for a Spin
      4. 3.12.4. How Greasemap Identifies Locations
      5. 3.12.5. See Also
    13. 28. How Big Is That, Exactly?
      1. 3.13.1. The Hack
      2. 3.13.2. The Code
      3. 3.13.3. How Big Is “That Big”?
  9. 4. On the Road with Google Maps
    1. 4.1. Hacks 29–41: Introduction
    2. 29. Find the Best Gasoline Prices
      1. 4.2.1. What a Gas!
      2. 4.2.2. GasWatch
    3. 30. Stay Out of Traffic Jams
      1. 4.3.1. Avoiding Gridlock in the United States
      2. 4.3.2. Avoiding Gridlock in the United Kingdom
      3. 4.3.3. But, Wait, There’s More!
      4. 4.3.4. Hacking the Hack
    4. 31. Navigate Public Transportation
      1. 4.4.1. Vancouver
      2. 4.4.2. Boston
      3. 4.4.3. Seattle
      4. 4.4.4. New York City
      5. 4.4.5. Chicago
      6. 4.4.6. Where’s My City?
    5. 32. Locate a Phone Number
    6. 33. Why Your Cell Phone Doesn’t Work There
    7. 34. Publish Your Own Hiking Trail Maps
    8. 35. Load Driving Directions into Your GPS
      1. 4.8.1. See Also
    9. 36. Get Driving Directions for More Than Two Locations
    10. 37. View Your GPS Tracklogs in Google Maps
      1. 4.10.1. Processing GPX Tracks to Reduce Complexity
      2. 4.10.2. Converting GPX to JavaScript Calls Using Ruby
      3. 4.10.3. Supporting HTML and JavaScript for GPX Viewing
      4. 4.10.4. Client-Side Implementation
      5. 4.10.5. Other Possibilities
      6. 4.10.6. See Also
    11. 38. Map Your Wardriving Expeditions
      1. 4.11.1. The Hack
      2. 4.11.2. The Code
      3. 4.11.3. Hacking the Hack
    12. 39. Track Your Every Move with Google Earth
      1. 4.12.1. Peering into the Keyhole
      2. 4.12.2. Back Down to Earth
      3. 4.12.3. The Code
      4. 4.12.4. Hacking the Hack
        1. 4.12.4.1. Pre-cache the Google Earth data.
        2. 4.12.4.2. Let other Google Earth users follow along in real time.
        3. 4.12.4.3. Add other people’s photos into the browser window.
        4. 4.12.4.4. Add other people’s photos into Google Earth itself.
    13. 40. The Ghost in Google Ride Finder
      1. 4.13.1. Finding the Data
      2. 4.13.2. Accumulating the Data
      3. 4.13.3. Plotting the Data
      4. 4.13.4. Hacking the Hack
      5. 4.13.5. See Also
    14. 41. How Google Maps Got Me Out of a Traffic Ticket
      1. 4.14.1. See Also
  10. 5. Google Maps in Words and Pictures
    1. 5.1. Hacks 42–50: Introduction
    2. 42. Get More out of What You Read
    3. 43. Don’t Believe Everything You Read on a Map
    4. 44. You Got Your A9 Local in My Google Maps!
    5. 45. Share Pictures with Your Community
    6. 46. Browse Photography by Shooting Location
      1. 5.6.1. Tag, You’re It
      2. 5.6.2. The Catch
      3. 5.6.3. The Code
      4. 5.6.4. Hacking the Hack
    7. 47. Geotag Your Own Photos on Flickr
    8. 48. Tell Your Community’s Story
      1. 5.8.1. The Hack
      2. 5.8.2. Getting Started
      3. 5.8.3. Adding Your Own Locations
      4. 5.8.4. Adding Photos to the Map
    9. 49. Generate Geocoded RSS from Any Google Map
      1. 5.9.1. The Hack
      2. 5.9.2. The Code
    10. 50. Geoblog with Google Maps in Thingster
      1. 5.10.1. Enter Thingster
      2. 5.10.2. Adding Maps to Blogs
      3. 5.10.3. Practice
      4. 5.10.4. How Do You Actually Use Thingster?
  11. 6. API Tips and Tricks
    1. 6.1. Hacks 51–61: Introduction
    2. 51. Make a Fullscreen Map the Right Way
      1. 6.2.1. Making a Map Take Up the Full Screen
      2. 6.2.2. Adding a Side Panel to the Map
    3. 52. Put a Map and HTML into Your Info Windows
      1. 6.3.1. See Also
    4. 53. Add Flash Applets to Your Google Maps
      1. 6.4.1. Flash in the Info Window
      2. 6.4.2. Communication Between Flash and Your Google Map
      3. 6.4.3. Beyond Flash
    5. 54. Add a Nicer Info Window to Your Map with TLabel
      1. 6.5.1. Using TLabel
    6. 55. Put Photographs on Your Google Maps
    7. 56. Pin Your Own Maps to Google Maps with TPhoto
    8. 57. Do a Local Zoom with GxMagnifier
      1. 6.8.1. The Hack
      2. 6.8.2. Doing More with GxMagnifier
        1. 6.8.2.1. Zooming.
        2. 6.8.2.2. Resizing.
        3. 6.8.2.3. Capturing the cick.
        4. 6.8.2.4. Moving the button.
        5. 6.8.2.5. Automatically panning.
        6. 6.8.2.6. Docking.
        7. 6.8.2.7. Multiple magnifiers and negative zoom.
      3. 6.8.3. See Also
    9. 58. Find the Right Zoom Level
      1. 6.9.1. The Brute Force Method
      2. 6.9.2. The Analytic Method
      3. 6.9.3. The Undocumented API Method
    10. 59. Show Lots of Stuff—Quickly
      1. 6.10.1. The Code
      2. 6.10.2. See Also
    11. 60. Make Things Happen When the Map Moves
      1. 6.11.1. The Hack
      2. 6.11.2. The Code
      3. 6.11.3. The GEvent API
      4. 6.11.4. Hacking the Hack
    12. 61. Use the Right Developer’s Key Automatically
      1. 6.12.1. Pick the Right Key in Perl
      2. 6.12.2. Use JavaScript to Accomplish the Same Goal
      3. 6.12.3. Using Apache’s mod_rewrite to Share Keys
      4. 6.12.4. Edit .htaccess to Rewrite Requests
      5. 6.12.5. See Also
  12. 7. Extreme Google Maps Hacks
    1. 7.1. Hacks 62–70: Introduction
    2. 62. Find the Latitude and Longitude of a Street Address
      1. 7.2.1. The Hack
      2. 7.2.2. The Code
        1. 7.2.2.1. XML-RPC.
        2. 7.2.2.2. REST.
        3. 7.2.2.3. SOAP.
      3. 7.2.3. The Caveats
      4. 7.2.4. Geocoding Addresses Outside the U.S.
      5. 7.2.5. See Also
    3. 63. Read and Write Markers from a MySQL Database
      1. 7.3.1. Structuring Your Database
      2. 7.3.2. The Code
      3. 7.3.3. See Also
    4. 64. Build Custom Icons on the Fly
      1. 7.4.1. The Hack
      2. 7.4.2. The Code
      3. 7.4.3. See Also
    5. 65. Add More Imagery with a WMS Interface
      1. 7.5.1. The Hack
      2. 7.5.2. The Code
      3. 7.5.3. The Virtues of Additional Map Layers
      4. 7.5.4. Finding and Using Other WMS Servers
      5. 7.5.5. See Also
    6. 66. Add Your Own Custom Map
      1. 7.6.1. Four Steps to Add a Custom Map
      2. 7.6.2. Create a New Map Type
      3. 7.6.3. Set the Path to Your Map Images
      4. 7.6.4. Customize Your Map’s Button Name
      5. 7.6.5. Add Your Map to the List of Map Types
      6. 7.6.6. See Also
    7. 67. Serve Custom Map Imagery
      1. 7.7.1. Conclusion
      2. 7.7.2. See Also
    8. 68. Automatically Cut and Name Custom Map Tiles
      1. 7.8.1. The Google Map Tile Structure
      2. 7.8.2. Figuring Out the Values for Your Tiles
      3. 7.8.3. Configuring the Script
        1. 7.8.3.1. ZoomLevel.
        2. 7.8.3.2. FolderPath.
        3. 7.8.3.3. Furthest zoom upper-left corner values.
      4. 7.8.4. Running Our Script in Photoshop
      5. 7.8.5. Hacking the Hack
      6. 7.8.6. See Also
    9. 69. Cluster Markers at High Zoom Levels
      1. 7.9.1. The Hack
      2. 7.9.2. Choosing the Right Clustering Algorithm
        1. 7.9.2.1. k-means clustering.
        2. 7.9.2.2. Hierarchical clustering.
        3. 7.9.2.3. Naïve grid-based clustering.
      3. 7.9.3. The Code
        1. 7.9.3.1. The server-side CGI script.
        2. 7.9.3.2. The client-side JavaScript.
      4. 7.9.4. Conclusion
      5. 7.9.5. See Also
    10. 70. Will the Kids Barf? (and Other Cool Ways to Use Google Maps)
      1. 7.10.1. Other Cool Google Maps Hacks
        1. 7.10.1.1. Google sightseeing.
        2. 7.10.1.2. ZIP Code maps.
        3. 7.10.1.3. Google Planimeter.
        4. 7.10.1.4. Play games on Google Maps.
        5. 7.10.1.5. Map versus satellite.
        6. 7.10.1.6. Edible plants in the public domain.
        7. 7.10.1.7. Animate a route.
        8. 7.10.1.8. Track your credit card spending.
      2. 7.10.2. Where to from Here?
  13. Index
  14. About the Authors
  15. Colophon
  16. Special Upgrade Offer
  17. Copyright