Hack 19. Map Local Weather Conditions

Find out whether there's weather where you are.

It's a well-known fact that everyone likes to talk about the weather, yet no one ever seems to do anything about it. Seriously, though, whenever two strangers meet and make small talk, it's inevitable that the recent meteorological conditions will make an appearance in the conversation. The state of the weather outside today, whatever it turns out to be, is something we all have in commonwe're all obliged to endure it or enjoy itat least, those of us that go out of doors.

3.4.1. The Situation Outside Is…

Naturally, it didn't take long for someone to set up a Google Maps site devoted to tracking the weatherand we don't just mean any old weather, we mean detailed weather data, including temperature, wind speed and direction, relative humidity, and daily rainfall. Dave Schorr's Google Weather Maps site, at http://www.weatherbonk.com/, collects meteorological data aggregated by Weather Underground and Weatherbug from thousands of personal weather stations across the world, and then plots that information in a rich Google Maps interface on the Web.

Figure 3-5 shows the default view of weatherbonk.com, centered on San Francisco, California. If, as chance would most likely have it, you're not in San Francisco, you can start by entering your location in the search box at the top of the page. Valid location styles take the form city, state, or city, country. U.S. ZIP Codes also work. In addition, you can overlay points from multiple locations by separating each query with a semicolon (;). For example, entering 33010;33446 will give you points along the southeast coast of Florida.

While a good number of international cities come up with results, you may need to be careful about what you type in here; for example, typing in "London, UK" returns nothing, while "London, England" returns what you would expect.

Also, at the time of this writing, Google only has detailed street maps for the U.S., U.K., Canada, and Japan. If you see broken image links in the background of the map, Google has not yet created street maps for your area. In this case, keep zooming out until the map appears, and/or click the Satellite button on the map to switch to the satellite view.

As you can see from Figure 3-6, the Weatherbonk.com site uses dynamically generated marker icons to convey a great deal of information at once. Each one of the weather station markers plotted on the map is color-coded according to the local temperature, ranging from blue (coldest) to red (hottest). Also, the temperature reading is displayed on the markers themselves, in either degrees Fahrenheit or Celsius, at your option.

If present, a spike extending from a marker points into the prevailing wind directioni.e., toward the wind, not away from itwhile the number of ticks shown on the spike indicates the observed wind speed, ranging from no ticks, representing a wind speed of under 4 mph, up to four ticks, indicating winds of 16 mph or more. Additionally, a marker may contain an icon illustrating other current conditions, such as sunshine, overcast, or rain. A key to these markers is shown at the bottom right corner of the page.

Clicking on any of the markers opens an info window with the details for that weather station, as shown in Figure 3-6. If the station is affiliated with Weather Underground, temperature, wind speed and direction, and relative humidity are shown. Below these readings, you'll see a graph illustrating the 24-hour history for both temperature and dew point. The title at the top of the info window is linked to the homepage of the maintainer of that particular station.

Figure 3-5. The default view, showing the current conditions in San Francisco

The dew point, in case you're wondering, is the temperature at which the water vapor in the air begins to condense into liquid water. Relative humidity, which is what's shown in the info windows, is calculated from a combination of ambient temperature and dew point. Frosty drinks on a hot day often lower the temperature of the air immediately around them to a level below the dew point, which is why a layer of condensation forms on the outside of the glass.

By contrast, a Weatherbug-affiliated station shows an info window with a daily rainfall figure, in place of the historical graph. Some Weatherbug stations also have webcams, which are shown in the info window, if present. Weatherbug stations aren't shown on the map by defaultyou need to select the Weatherbug checkbox at the top of the page and then click the Update Map button at the top right of the map.

Other, not necessarily weather related, webcams can be shown on the map as well. Select the Webcams checkbox at the top of the page, if it isn't already selected, and then click Update Map. These locations, which are often educational institutions, are identified on the map by transparent markers. As you'd expect, clicking on a webcam icon opens an info window showing the current image from that location.

Figure 3-6. Weather station details are shown in an info window

The info windows shown on the map can often be quite large, what with all the weather information and webcam images they include. One result of this is that the X button used to close the info window can occasionally wind up obscured by other things on the map. Fear notyou can always close an open info window by clicking on the associated marker a second time.


3.4.2. More Than Just the Weather

The Weatherbonk.com site supports some other interesting features. On the right side of the map, you can select various sources of radar data, to depict cloud cover on the map. Additionally, under the Google Earth section of the page, you can access different sources of cloud radar imagery in KML format, for use with Google Earth.

From the standpoint of Google Maps, however, the most interesting additional features are the three map control buttons at the top right corner of the map, immediately below the map type control. These buttons are labeled Zoom Box, Clear Points, and Update Map. The Clear Points button wipes all the markers off the map, while the Update Map button loads new data from the server, which can be handy if you zoom or pan the map to view a different area.

The Zoom Box feature is particularly nifty and bears a bit of explanation. If you hold down Shift-Z, and then left-click and drag your mouse across the map, a red box appears and follows your mouse drag. Releasing the left mouse button causes the map to zoom into the area within the red box, which can be quite handy for drilling down to a particular local region. Clicking Update Map after you've used the zoom box feature can sometimes reveal weather stations that weren't shown on the larger area map, as the site tries to avoid crowding the map with too many points at any given zoom level. Also, you don't actually need to click the Zoom Box button before using this featurethe button itself doesn't do anything useful, beyond displaying helpful instructions in an alert window.

3.4.3. Microclimates and Distributed Weather Reporting

Like so many other things, the Internet has made it possible for weather reporting to be distributed among many people on a ground-up basis, rather than centralized in a top-down fashion, as it traditionally has been. One thing that this decentralization makes possible is witnessing for yourself the striking variety of weather conditions in an area with lots of microclimates, like the San Francisco Bay Area. Try it mid-to late-afternoon Pacific Time (GMT -7 during the Daylight Savings Time, GMT -8 otherwise), when the fog usually starts to creep in off the ocean, thus cooling some areas, while other places are still clear and warm. To augment this view, try adding the Bay Area fog overlay from the Overlays drop-down on the right side of the page. The differences across an area even as small as San Francisco can sometimes really be quite striking.

3.4.4. See Also

  • The Weather Underground site at http://wunderground.com/ has RSS feeds for weather reports in various metropolitan areas.
  • http://api.weatherbug.com/ is the home for Weatherbug's data access API.
  • METAR is a very terse text format used around the world for reporting weather data. You can find out more about METAR, and get live METAR feeds from the U.S. National Weather Service at http://weather.noaa.gov/weather/metar.shtml.
  • http://anti-mega.com/weather/ offers a series of (non-georeferenced) RSSbased weather feeds, using data scraped from worldweather.org.

written with assistance from Dave Schorr

You Are Here: Introducing Google Maps

Introducing the Google Maps API

Mashing Up Google Maps

On the Road with Google Maps

Google Maps in Words and Pictures

API Tips and Tricks

Extreme Google Maps Hacks

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

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