NAME
Weather::YR::Locationforecast - Used to fetch forecast from a geo position from YR
DESCRIPTION
This module returns textforecasts from YR according to specified parameters.
This module uses the data from URLs such as these: http://api.yr.no/weatherapi/locationforecast/1.4/?lat=60.10;lon=9.58
DESCRIPTION FROM YR API
This modules implements a full forecast for one location, that is, a forecast with five parameters for a seven-day period.
The five parameters are temperature, wind speed, wind direction, pressure and precipitation.
For the first 48 hours, the datapoints are spaces one hour apart, and for the remaining five 24-hour periods, they are spaces three hours apart.
CONFIGURATION
url
The URL to the web service for getting the textforecasts. Defaults to version 1.4 of the API: http://api.yr.no/weatherapi/locationforecast/1.4/.
latitude
The latitude of the location. No default, must be applied in constructor.
longitude
The longitude of the location. No default, must be applied in constructor.
METHODS
new(\%args
)
Constructor that validates the incoming parameters. We request these parameters to be set: latitude longitude
forecast
Retrieves the forecast in a data structure representing the XML document.
parse_weatherdata($xml
)
This method parses the response from YR and returns a structure of objects.
parse_forecast_time($time_ref
)
This method parses each time element in the forecast XML document.
parse_forecast_full($location
)
This method parses full/complete forecasts which contains different types of data.
parse_forecast_symbol($location
)
This method parses forecasts that contains symbol data.
parse_forecast_precip($location
)
This method parses forecasts that contains precipitation data.
get_url
Assembles the complete URL for the textforecast service with the forecast type and language.
SEE ALSO
AUTHOR
Knut-Olav, <knut-olav@hoven.ws>
COPYRIGHT AND LICENSE
Copyright (C) 2008 by Knut-Olav Hoven
This library is free software; you can redireibute it and/or modify it under the terms as GNU GPL version 2.