This is a webpage that allows you to search for weather information using the Google Geocode and Forecast.io APIs, and the results will be displayed in tabular format.
- A user first opens a page, called forecast.php, where he/she can enter an address (street, city, and state) and select the temperature unit (Fahrenheit, Celsius).
- The form should include a forecast.io disclaimer, linking to ‘http://forecast.io/’.
- If the user did not enter one of the data items, then an alert will be shown to let the user provide complete information.
- Clear button is used for clearing the result area, all text fields, unselect the State value and reset the “Degree” field to its default value of Fahrenheit.
Web service URL: http://maps.google.com/maps/api/geocode/xml?address=325 W Adams,Los Angeles,CA
The response of this URL is an XML-formatted object. One key piece of data returned is the latitude and longitude values for the given address.
For the given location such as, queries like below:
https://api.forecast.io/forecast/YOUR_APIKEY/LATITUDE,LONGITUDE?units=units_v alue&exclude=flags
When constructing the Forecast.io web service API call, you should provide five parameters:
- The first parameter is your Forecast.io API key (a.k.a. the Dark Sky API key).
- The second and the third parameter are the latitude and longitude values which are extracted from the XML-formatted data returned by the Google Geocode API.
- The name of fourth parameter is units. The value of this parameter is either “us” or “si”. If the temperature is in degree Celsius, units=si and if the temperature is in degree Fahrenheit, units=us.
- The name of the fifth parameter is exclude. The value of this parameter is “flags”.