Jump to content

Aviation Weather V1.0


Parkho

Recommended Posts

  • Moderators

Aviation Weather V1.0

----------------------------------------

A module to retrieve weather information for a specific station using airfield ICAO

----------------------------------------

Source:

https://www.aviationweather.gov API

Install:

1. Download the repository from Git-hub

2. Unzip and upload in folders order

3. Access it by <?php echo url('/wthr') ;?>

4. Enjoy!!!!

-----------------------------------------

Demo & Support:

Visit www.parkho.ir and use contact me form for support and pilots-modules for demo.

-------------------------------------------------------------------

Screen shots:

wthr1.PNG

wthr2.PNG

wthr3.PNG

  • Like 1
Link to comment
Share on other sites

Hello i have a problem with the module:

Warning: simplexml_load_file(https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=lirf&hoursBeforeNow=1) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /membri/italianichevolano/core/modules/WTHR/WTHR.php on line 13

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=lirf&hoursBeforeNow=1" in /membri/italianichevolano/core/modules/WTHR/WTHR.php on line 13

Thanks for a possible answer ...

Yours sincerely

Link to comment
Share on other sites

Hello i have a problem with the module:

Warning: simplexml_load_file(https://www.aviation...oursBeforeNow=1) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /membri/italianichevolano/core/modules/WTHR/WTHR.php on line 13

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "https://www.aviation...ursBeforeNow=1" in /membri/italianichevolano/core/modules/WTHR/WTHR.php on line 13

Thanks for a possible answer ...

Yours sincerely

Create TPL file and copy the code from the folder TEMPLITE.

In the module file, change the php to tpl.

<?php
class WTHR extends CodonModule
{
 public function index()
  {
		    $this->show('weather/weather.tpl');
  }

 public function metar()
  {
   $icao = DB::escape($_POST['icao']);
   $url = 'https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString='.$icao.'&hoursBeforeNow=1';
   $xml = simplexml_load_file($url);
   $metar = $xml->data->METAR->raw_text;
   $altimeter = $xml->data->METAR->altim_in_hg;
   $dewpoint = $xml->data->METAR->dewpoint_c;
   $flightrules = $xml->data->METAR->flight_category;
   $station = $xml->data->METAR->station_id;
   $temperature = $xml->data->METAR->temp_c;
   $time = $xml->data->METAR->observation_time;
   $visibility = $xml->data->METAR->visibility_statute_mi;
   $winddir = $xml->data->METAR->wind_dir_degrees;
   $windspd = $xml->data->METAR->wind_speed_kt;
   $lat = $xml->data->METAR->latitude;
   $lng = $xml->data->METAR->longitude;
   $sky1 = $xml->data->METAR->sky_condition[1]->sky_cover;
   //$sky2 = $xml->data->METAR->sky_condition[1];
   $elevation = $xml->data->METAR->elevation_m;
   $sql="SELECT * FROM phpvms_airports WHERE icao = '$station'";
   $airport = DB::get_row($sql);

   $this->set('metar', $metar);
   $this->set('altimeter', $altimeter);
   $this->set('dewpoint', $dewpoint);
   $this->set('flightrules', $flightrules);
   $this->set('airport', $airport);
   $this->set('temperature', $temperature);
   $this->set('time', $time);
   $this->set('visibility', $visibility);
   $this->set('winddir', $winddir);
   $this->set('windspd', $windspd);
   $this->set('lat', $lat);
   $this->set('lng', $lng);
   $this->set('elevation', $elevation);
   $this->set('sky1', $sky1);
   //$this->set('sky2', $sky2);
   $this->set('station', $station);

   $this->render('weather/weather.tpl');
  }
}
?>[/size][/font][/color]
[color=#333333][font=Arial, Helvetica, sans-serif][size=4]
Link to comment
Share on other sites

  • Moderators

I always wonder why some of Airline mangers avoid upgrading their phpVMS and insist of using the old versions!!!!!!!!

Everyone, I am creating these new modules with the latest version of phpVMS which is 5.5x by Simpilot. Since I'm creating these modules as my hobby and never get paid for them and still am willing to give support for my creation, I will not be able to make them for the old versions and support them too. So, I will much appreciate it if you guys upgrade your software to avoid further issues with my modules.

Thanks

  • Like 1
Link to comment
Share on other sites

  • Moderators

There is an update. Please download and replace modules/wthr/wthr.php and templates/weather/weather.php from github.

Change log:

-The use of phpVMS built-in functions has been avoided.

Reason

Some airfields are not yet added to phpVMS DB and that makes the module to not showing the results for all ICAOs.

Edited by parkho
Link to comment
Share on other sites

  • Moderators

I have just installed it and there seems to be a few missing images. I uploaded everything the way it should. http://malaysiava.or....php/WTHR/metar You can see there if you do a look up for any airport. Thanks for the module, looks great

Noted and images added. Please download and replace "lib" folder at github

Link to comment
Share on other sites

  • 2 months later...

Hello..

I am getting such errors :

Warning: simplexml_load_file(https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=VABB&hoursBeforeNow=1): failed to open stream: Connection timed out in /home/litejoro/public_html/crew/core/modules/WTHR/WTHR.php on line 14

Warning: simplexml_load_file(): I/O warning : failed to load external entity "https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=VABB&hoursBeforeNow=1" in /home/litejoro/public_html/crew/core/modules/WTHR/WTHR.php on line 14

Warning: simplexml_load_file(https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=stations&requestType=retrieve&format=xml&stationString=VABB): failed to open stream: Connection timed out in /home/litejoro/public_html/crew/core/modules/WTHR/WTHR.php on line 32

Warning: simplexml_load_file(): I/O warning : failed to load external entity "https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=stations&requestType=retrieve&format=xml&stationString=VABB" in /home/litejoro/public_html/crew/core/modules/WTHR/WTHR.php on line 32

Website : http://crew.litejetv...index.php/WTHR/

php.ini :allow_url_fopen = On

allow_url_include = On

Edited by shrikar
Link to comment
Share on other sites

The module is working just fine with 5.5x version, so unless you're on a free host service, the module should work for you as well.

[sOLVED] A infected file had blocked my Port 80/446. Deleted that file and requested my host to open up the Port. Now everything works well .

Edited by shrikar
Link to comment
Share on other sites

  • 3 weeks later...
  • Moderators

hey guys,

i installed this great add-on but getting this error... any ideas?

Notice: The template file "/var/www/......../core/templates/weather/weather.php" doesn't exist in /var/www/vhosts/......................./core/classes/TemplateSet.class.php on line 231

That means you haven't added "weather" folder to the root.

  • Like 1
Link to comment
Share on other sites

  • Moderators

Okay! In "core" folder you have 3 other folders "common", "modules", and "templates". Inside "common" there is php file which will go to your "root/core/common" folder. Inside "modules" there is another folder called "WTHR" with a php file inside it, copy the whole folder to your "root/core/modules" folder. Finally, inside "templates" there is a folder called "wthr" with 2 php files inside it, copy the folder to your "root/lib/skins/(name of the skin you're using)" folder and you're done. Same procedure goes with all of my modules.

Edited by parkho
Link to comment
Share on other sites

Hi Parkho.

First off, i appreciate your efforts and time you put in for this community and your work on modules. Thank you very much! I installed this module today and showed it to everyone on site and the overall opinion of it is everyone loves it.

We found one minor detail that is no biggie. not sure if this is correct spelling in another language but in common North American English, http://prntscr.com/d5coll Aiviation is spelled Aviation. lol I looked at and admired this module all day and it just now only dawned on me what I was reading. :D

This module is great Parkho. I appreciate your sharing it with us to use.

Ray

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...