Please add the weather forecasts (for i.e. 3 next days) or the possibility of choosing the day of the weather information (today, tomorrow, etc.)!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fm’s picture

seconded.

toddy’s picture

Title: Weather forecast or choose date » Weather forecasts
Status: Active » Postponed

I'm currently not able to implement weather forecasts, sorry.

toddy’s picture

I'm currently not able to implement weather forecasts, sorry.

mherchel’s picture

thirded... I would like the ability to show the weather for a set date in the future (assuming the data is available).

Thanks for a great module by the way! Happy New Year!

Alpha5’s picture

Me too, feature request: weather forecasts

fm’s picture

Terrific module, however ...

without the ability to forecast, a weather report is no more helpful than poking your head out the window.

j0k3z’s picture

I would love this feature

marius.s’s picture

Forecast is definitely needed, that's the whole point of having a Weather module.
What are the obstacles for implementing it? Maybe the community can help.

fm’s picture

Any progress on this? Forecast is really a must have feature.

klonos’s picture

subs

kentr’s picture

If one of you others want to take a stab at it, I think what you want is to parse the TAF data. It seems that METAR data doesn't contain forecast information.

Some details on TAF data:

http://weather.noaa.gov/weather/taf.shtml
http://en.wikipedia.org/wiki/Terminal_Aerodrome_Forecast

Looks like PEAR already has a forecast function, so you could start there as well:
http://pear.php.net/manual/en/package.webservices.services-weather.php

Update: Here's a better starting point, along with code samples (one of which presents a full icon-based forecast - the final one, I think):
http://phpstarter.net/2008/12/5-sources-of-free-weather-data-for-your-site/
http://phpstarter.net/2009/03/more-examples-with-parsing-ndfd-data-in-php/

CKIDOW’s picture

subscribing

dufferin’s picture

Would love that too...

seaslug’s picture

I would also like TAF implemented in this module.

I have PHP code available for Converting TAF into a readable format if your interested. Cant honestly say its well coded but it does work.

As well as some other additional METAR features such as Instrument meteorological conditions etc for pilots. (DISPLAYS IMV, VMC or VFR depending on conditions)

I'll try spend some time and see if i can develop TAF module to plugin with this one...

rbrownell’s picture

+1 subscribe

sokrplare’s picture

Any progress on this, seaslug? Need this for a current project so would be willing to commit some developers / money to this but don't want to duplicate anything you've done?

For other's reference, it looks like two other modules provide some semblance of forecast functionality (haven't tried them myself):

sokrplare’s picture

FileSize
60.04 KB

Just tried installing a plain vanilla of the nws_weather and it will do the trick! Very well done end result.

Attached a screenshot of the default block made available (see the README for how to call programmatically).

kfurlotte’s picture

subscribe

seaslug’s picture

Sorry for the seriously delayed reply, my excuse is Life ....
I'm months away from getting stuck into creating this module, most of the code is in PHP but will take me sometime to get into using Drupal API

kentr’s picture

I have a simple Weather Underground forecast module if anyone's interested. Just send me a PM.

klonos’s picture

Hey Kent! What a great chance to start a new project in d.o. ;)

kentr’s picture

@klonos:

I thought about it, but I have no time for management or development of the project. It's already pretty much at "abandoned" status...

There are 2 other forecast modules available, so I don't think the community is lacking in this area.

klonos’s picture

If you have no time, you can always start a project and immediately ask for a co-maintainer and hand it over to them.

kentr’s picture

@klonos:
I have no time to go through the process of starting a project and handing it over to someone else.

Drupal already has 2 weather forecast modules. Would a half-built, unmaintained 3rd actually benefit the community? My perspective is that it would be more of a thorn in the paw than an asset for the majority of the Drupal users trying to decide which to use.

klonos’s picture

Point taken... you can perhaps upload it in an issue of the Weather Underground module then. This way if it has functionality that is not already included in the module, the maintainers might consider adding it ;)

picacsso’s picture

I wanted to share this with the community.

The weather forecast is not included within this module but there is a quick work around for this.
The only drawback is that in order to view the forecast, you'll need to be redirected to the weather.gov website.

Open your weather.tpl.php file and paste this code right before the closing div tag:

global $user;
$uid = $user->uid;

$lat = "SELECT icao FROM {weather_config} WHERE uid = '$uid'";
$result = db_result(db_query($lat));

echo '<a href="http://forecast.weather.gov/zipcity.php?inputstring='.$result.'">Extended Forecast</a>';

This will create an active link in your weather block that will take you to the websitesite where you'll see your locations' forecast, and a much more.

I know this isn't the best solution, but it worked for me.

greg0ryv’s picture

Version: 6.x-5.x-dev » 7.x-1.x-dev
Status: Postponed » Active

Has anyone been able to add TAF's to this? I'd like to use the Metar data and the TAF data - no formatting required. Some locations do not have TAF's so that's fine.

aj2’s picture

Similar to Post #26, this will also work for the Location module, but again is a poor work around.

Before the end div tag, paste the following:

<?php
      if (user_access('access content')) {
        // Set up the node location weather block.
        if (arg(0) == 'node' and is_numeric(arg(1))) {
          $node = node_load(arg(1));
          // This checks the location module.
          if (isset($node->locations)) {
            // Iterate through all available locations and check
            // for lat/long information. If there is no information,
            // the location module returns 0.0/0.0 instead of NULL values.
            foreach ($node->locations as $location) {
              if (($location['latitude'] != 0) or ($location['longitude'] != 0)) {
                echo '<br><a href="http://forecast.weather.gov/MapClick.php?lat='.$location['latitude'].'&lon='.$location['longitude'].'">Extended Forecast</a>';
              }
            }
          }
        }
      }
?>

Note: to embed the forecast properly, would probably want to use the National Weather Service SOAP web service. (http://graphical.weather.gov/xml/ )

aj2’s picture

Forecasts can be obtained from the National Weather Service SOAP web service. Below is an example code snippet for grabbing and displaying forecast data. Perhaps this could be integrated into the weather module as an optional block?

References:
http://graphical.weather.gov/xml/
http://graphical.weather.gov/xml/sample_products/ndfdXML.tar

tested with xsl style sheets from the weather.gov sample tar file in XSLT dir.

<?php
/* Test the weather.gov SOAP server to grab a forecast with client */

// The wsdl URL
 $wsdl_url = 'http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl' ;

 // Setup the Querry Parameters for weather.gov NDFDgenByDay
 $latitude  = new SoapParam( 41.912, "latitude") ;
 $longitude = new SoapParam( -81.989, "longitude")  ;
 $startDate = new SoapParam(  date( "Y-m-d" ), "startDate") ;
 $numDays   = new SoapParam( 5, "numDays" ) ;
 $Unit      = new SoapParam( 'e', "Unit");
 //$format    = new SoapParam( '24 hourly', "format") ;
 $format    = new SoapParam( '12 hourly', "format") ;

// Create the Soap Client
$soapclient = new SoapClient($wsdl_url,  array("exceptions" => 0, "trace" => 0) );

// Querry the Server for NDFDgenByDay xml information
 $xml = $soapclient->NDFDgenByDay($latitude, $longitude, $startDate, $numDays, $Unit, $format );

// Translate the XML to HTML
// .........................


  // create a DOM document and load the XSL stylesheet
  $xsl = new DomDocument;

  // The xsl StyleSheet to use
  $xsl->load('sampleXSL_12hr.xsl');
  //$xsl->load('sampleXSL_24hr.xsl');

  // Create an XML domDoc object for transform
  $xml_doc = new domDocument;
  $xml_doc->validateOnParse = true;
  $xml_doc->loadXML( $xml ) ;


  // import the XSL stylesheet into the XSLT process and transform
  $xp = new XSLTProcessor();
  $xp->importStylesheet($xsl);

  // transform the XML into HTML using the XSL file
  if ($html = $xp->transformToXML($xml_doc))
  {
    // Return the HTML 
    echo $html;
  }
  else
  {
    trigger_error('XSL transformation failed.', E_USER_ERROR);
  }

?>
toddy’s picture

Assigned: Unassigned » toddy
Status: Active » Fixed

Weather forecasts are now possible with weather 7.x-2.0. Enjoy!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

klonos’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes

...correct branch where this is fixed then ;)