![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
![]()
You can use PHP (yet another web programming language) to do this trick.
Checkout my home page at http://www.brenorbrophy.com/ to see the results. I retrieve the METARs for some of my local airports, the airport name gets color coded depending on the conditions (LIFR/IFR/MVFR & VFR), the time get color'd red if its more than 1 hour old. I also get the TAF for a couple of local airports. I use this to get a real quick over view of the local area weather. For the non-programmer, PHP is a scripting language that runs on a web server. When somebody views the web-page the script is executed and it outputs HTML code which is displayed on the web-page. Whoever is hosting your web-page needs to allow PHP scripts to run. Now I'm not a PHP genius, I hacked a piece of code called PHP Weather (version 2.1) which is available at http://phpweather.sourceforge.net/. Quick overview of what I did. 1) Downloaded and unziped PHP Weather. Put it in a directory on my web page called weather. 2) Created a file called wx.php (my hack) and put it in same directory 3) Added an inline frame to my homepage as set wx.php as the source, the HTML for this is: iframe src="weather/wx.php" name="wx bar" width="600" marginwidth="0" height="170" marginheight="0" align="middle" scrolling="no" frameborder="0"/iframe Here is wx.php file - it should be obivious how to modify it for a different set of METARs and TAFs (Hint look at the arrays called $Airport & $tAirport) html head titleUntitled Document/title meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /head body table width="596" border="0" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#FFFFFF" tr td width="60%" valign="top" ?php //error_reporting(E_ALL); /* We need the GET variables: */ extract($HTTP_GET_VARS); /* Load PHP Weather */ require('../weather/phpweather.php'); if (empty($language)) $language = 'en'; $weather = new phpweather(); //$weather-properties['verbosity'] = 5; $language = 'en'; require(PHPWEATHER_BASE_DIR . "/output/pw_text_$language.php"); $type = 'pw_text_' . $language; require(PHPWEATHER_BASE_DIR . "/output/pw_images.php"); $icons = new pw_images($weather); /* ** Airports array holds list of airports for METAR retrival ** tAirports array holds list of airports for TAF retrival */ $Airport = array ("KRHV","KWVI","KMRY","KAPC","KSCK","KSAC"); // For METAR $tAirport = array ("KSJC","KMRY"); // For TAF echo 'table width="100%" border="0" cellpadding="1" cellspacing="1"'; echo 'trtd colspan="2" valign="top" bgcolor="#99CCFF"font face="Verdana, Arial, Helvetica, sans-serif" size="2"strongMETAR '.gmdate("dHi\Z")."/strong/font/td/tr\n"; foreach ($Airport as $icao) { $weather-set_icao($icao); // Set the airport code $metar = $weather-get_metar(); // Get the METAR report if($metar!='') { // If I've got a valid METAR then $parts = explode(' ', $metar); // Break into parts so we can color various bits $num_parts = count($parts); // Count the parts $time = $parts[1]; // Extract the time issued part $vis = $parts[3]; // Extract visibility $weather-decode_metar(); // Decode it so we can check visability & ceiling /* ** Check for flight conditions ** LIFR (Low IFR) is vis 1SM &|| ceiling 500' - Color ICAO purple ** IFR is 1SM vis 3SM &|| 500' ceiling 1000' - Color ICAO red ** MVFR (Marginal VFR) is 3SM vis 5SM &|| 1000' ceiling 3000' - Color ICAO blue ** VFR is vis 5SM & ceiling 3000' - Color ICAO green ** ** Ceiling is altitude of lowest cloud type of BKN or OVC */ $vis = $weather-decoded_metar['visibility'][0]['miles']; // Get visibility $layer = $weather-decoded_metar['clouds']; // Get the cloud layers $ceiling = 999999; // Init ceiling value $group_num = 0; // Init cloud group value (there could be up to 3 cloud groups) foreach ($layer as $key=$group) { // For each cloud group /* ** We only care about OVC or BKN layers */ if (($group['condition'] == 'OVC') || ($group['condition'] == 'BKN') || ($group['condition'] == 'VV')) { if ($ceiling $group['ft']) { // Look for the lowest ceiling $ceiling = $group['ft']; // Records it if lower $group_num = $key; // Record the cloud group it occurs in } // end of found a lower ceiling } // end of condition OVC || BKN || VV } // end of checking all cloud layers if (($vis = 1) || ($ceiling = 500)) { $flight_condition = 'LIFR'; ($vis = 1) ? $vis_flag = true : $vis_flag = false; ($ceiling = 500) ? $ceiling_flag = true : $ceiling_flag = false; } elseif (($vis = 3) || ($ceiling = 1000)) { $flight_condition = 'IFR'; ($vis = 3) ? $vis_flag = true : $vis_flag = false; ($ceiling = 1000) ? $ceiling_flag = true : $ceiling_flag = false; } elseif (($vis = 5) || ($ceiling = 3000)) { $flight_condition = 'MVFR'; ($vis = 5) ? $vis_flag = true : $vis_flag = false; ($ceiling = 3000) ? $ceiling_flag = true : $ceiling_flag = false; } else { $flight_condition = 'VFR'; $vis_flag = false; $ceiling_flag = false; } echo 'trtd valign="top"font face="Verdana, Arial, Helvetica, sans-serif" size="1" '; switch ($flight_condition) { case 'LIFR': $color="#FF00FF"; break; // Purple color case 'IFR' : $color="#FF0000"; break; // Red color case 'MVFR': $color="#0000FF"; break; // Blue color case 'VFR' : $color="#009900"; break; // Green color default : $color="#000000"; // Should never happen but in case leave it black color } echo 'color="'.$color.'"strong'.$icao."/strong/font/td\n"; // print the airport code and close the cell /* ** Now we want to alert the user if the METAR data is old. So we will color the time stamp red if ** its is more than 1 hour old. */ echo 'td valign="top"font face="Verdana, Arial, Helvetica, sans-serif" size="1" '; // Start the cell and set the font if ($weather-metar_time time()-3600) { // METAR is more then 1 hour old echo 'color="#FF0000"'; } else { // METAR is less than 1 hour old echo 'color="#000000"'; } // end of METAR time check echo $time.'/font'; /* ** print remainder of the METAR ** ** Plan to add color high-light of Vis or cloud causing !VFR flight conditiond */ echo 'font face="Verdana, Arial, Helvetica, sans-serif" size="1"'.substr($metar,12,strlen($metar))."/td/tr\n"; } // end of valid METAR } // end of FOREACH loop on array of airports echo "/table/fontbr\n"; ? /td td width="40%" valign="top" ?php $text = new $type($weather); foreach ($tAirport as $icao) { $text-weather-set_icao($icao); // Set the Airport code $taf = $text-weather-decode_taf(); // Get and decode the TAF if($taf['taf']!='') { // If I've got a valid TAF then $parts = explode(' ', $taf['taf']); // Break into parts so we can color various bits $num_parts = count($parts); // Count the parts $time = $parts[1]; // Extract the time issued part echo 'table width="100%" border="0" cellpadding="1" cellspacing="1"'; echo 'trtd valign="top" bgcolor="#99CCFF"font face="Verdana, Arial, Helvetica, sans-serif" size="2"strongTAF '.$icao." ".$time."/strong/font/td/tr\n"; echo 'trtd valign="top"font face="Verdana, Arial, Helvetica, sans-serif" size="1"'; while(list($i,$period) = each($taf['periods2'])) { echo $period['data']."br\n"; } // end of while list of TAF periods echo "/td/tr\n"; echo "/table"; } // end of valid TAF } // end of FOREACH loop on array of airports ? /td /tr /table /body /html |
#2
|
|||
|
|||
![]()
wow those are great ideas guys..
I was telling another guy this, what I'd like to do is when I become a CFI here in salt lake - i'd like to be able to get live metar/taf's in a small font on a basic html page so I could use a web enabled phone to pull up the data at any time without running to a pc (I think it would be a cool idea) I've heard of some company out there that provides live radar and metar/taf data but they charge a price. Instead you could use link radar maps and resize them and include the metar/taf data for free on your own personal web page. Anyway thanks again for the info guys - I'll have to do some trial and error. Matthew |
#3
|
|||
|
|||
![]()
"Matthew Chidester" wrote in message
news:wDSbd.186189$wV.63846@attbi_s54... wow those are great ideas guys.. I was telling another guy this, what I'd like to do is when I become a CFI here in salt lake - i'd like to be able to get live metar/taf's in a small font on a basic html page so I could use a web enabled phone to pull up the data at any time without running to a pc (I think it would be a cool idea) You can get TAFs/METARs on a WAP phone using one of: http://www.wapmx.com (Aviation Weather from the index) http://wap.cupitt.com (all on the phone) There are others out there too. Paul |
#4
|
|||
|
|||
![]()
Oh sweet thanks Paul
![]() Matthew You can get TAFs/METARs on a WAP phone using one of: http://www.wapmx.com (Aviation Weather from the index) http://wap.cupitt.com (all on the phone) There are others out there too. Paul |
#5
|
|||
|
|||
![]()
"Paul Sengupta" wrote in message . ..
You can get TAFs/METARs on a WAP phone using one of: http://www.wapmx.com (Aviation Weather from the index) http://wap.cupitt.com (all on the phone) There are others out there too. Paul Hi Paul, Do you know of any services--preferably free--that will accept a cell phone SMS message with ICAO IDs, and send an SMS message back with METARs and TAFs? |
#6
|
|||
|
|||
![]()
In a previous article, (Bob Fry) said:
Do you know of any services--preferably free--that will accept a cell phone SMS message with ICAO IDs, and send an SMS message back with METARs and TAFs? I wrote one. But unfortunately a SMS message is too short, so it ends up coming back as three messages. -- Paul Tomblin http://xcski.com/blogs/pt/ I'm a person who can't understand why everyone in the entire nation doesn't look up, realise that George W Bush is their president, and not immediately throw up in their mouths. Shows what I know. - Harry Teasley |
#7
|
|||
|
|||
![]()
(Paul Tomblin) writes:
In a previous article, (Bob Fry) said: Do you know of any services--preferably free--that will accept a cell phone SMS message with ICAO IDs, and send an SMS message back with METARs and TAFs? I wrote one. But unfortunately a SMS message is too short, so it ends up coming back as three messages. Hmmm, is it available to the vast r.a.* audience? BF |
#8
|
|||
|
|||
![]()
In a previous article, Bob Fry said:
(Paul Tomblin) writes: In a previous article, (Bob Fry) said: Do you know of any services--preferably free--that will accept a cell phone SMS message with ICAO IDs, and send an SMS message back with METARs and TAFs? I wrote one. But unfortunately a SMS message is too short, so it ends up coming back as three messages. Hmmm, is it available to the vast r.a.* audience? I'm a little reluctant to share because I don't know what sort of volume it might get. Give it a try, send an sms to . You can specify the stations in the subject line or in the body. If the volume gets too high, I'll turn it off. -- Paul Tomblin http://xcski.com/blogs/pt/ You can be jailed for lying about being good in bed. -- Lionel, paraphrasing the Criminal Code of Canada, 159(3)(b)(i) |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
how can you get live METAR data ? - long | Bob Fry | General Aviation | 4 | November 5th 04 06:19 AM |
Pirep: Garmin GPSMAP 296 versus 295. (very long) | Jon Woellhaf | Piloting | 12 | September 4th 04 11:55 PM |
No METAR Data at AOPA and NWS? | Scott Lowrey | Piloting | 4 | March 3rd 04 07:19 PM |
Aviation Insurance History, data, records? | cloudclimbr | General Aviation | 0 | February 17th 04 03:36 AM |
Air Force conducts live test of MOAB | Otis Willie | Military Aviation | 0 | November 21st 03 10:45 PM |