O'Reilly logo

Google Maps JavaScript API Cookbook by Balkan Uraz, Alper Dincer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding the weather and cloud layers

Information on the temperature and weather conditions coupled with a map display is very common in weather reports on TVs; Google has put a feature in its API so that we can have this information in our own maps.

In this recipe, we will learn how to display weather-related information on top of base maps as overlays.

Getting ready

We can continue on from the Creating a simple map in a custom DIV element recipe from Chapter 1, Google Maps JavaScript API Basics, as we do not need to go into detail for the basic map display.

How to do it…

Here are the steps to show the respective temperatures and cloud conditions in your maps:

  1. Add the weather library to the end of the reference for the Google Maps JavaScript API:
     <script ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required