Class Summary Services_Weather_Metar

Class Summary Services_Weather_Metar – PEAR::Services_Weather_Metar


This class acts as an interface to the metar service of It searches for locations given in ICAO notation and retrieves the current weather data.

Of course the parsing of the METAR-data has its limitations, as it follows the Federal Meteorological Handbook No.1 with modifications to accommodate for non-US reports, so if the report deviates from these standards, you won't get it parsed correctly. Anything that is not parsed, is saved in the "noparse" array-entry, returned by getWeather(), so you can do your own parsing afterwards. This limitation is specifically given for remarks, as the class is not processing everything mentioned there, but you will get the most common fields like precipitation and temperature-changes. Again, everything not parsed, goes into "noparse".

If you think, some important field is missing or not correctly parsed, please file a feature-request/bugreport at and be sure to provide the METAR report with a _detailed_ explanation!

For a working example, please take a look at docs/Services_Weather/examples/metar-basic.php

Class Trees for Services_Weather_Metar

Services_Weather_Metar Inherited Methods

Inherited from Services_Weather_Common
Method Name Summary
Services_Weather_Common::calculateDewPoint() Calculate dewpoint from temperature and humidity This is only an approximation, there is no exact formula, this one here is called Magnus-Formula
Services_Weather_Common::calculateHumidity() Calculate humidity from temperature and dewpoint This is only an approximation, there is no exact formula, this one here is called Magnus-Formula
Services_Weather_Common::calculateWindChill() Calculate windchill from temperature and windspeed (enhanced formula)
Services_Weather_Common::convertDistance() Convert distance between km, ft and sm
Services_Weather_Common::convertPressure() Convert pressure between in, hpa, mb, mm and atm
Services_Weather_Common::convertSpeed() Convert speed between mph, kmh, kt, mps and fps
Services_Weather_Common::convertTemperature() Convert temperature between f and c
Services_Weather_Common::getUnitsFormat() Returns the selected units format
Services_Weather_Common::polar2cartesian() Convert polar coordinates to cartesian coordinates
Services_Weather_Common::setCache() Enables caching the data, usage strongly recommended
Services_Weather_Common::setDateTimeFormat() Changes the representation of time and dates (see
Services_Weather_Common::setHttpTimeout() Sets the timeout in seconds for HTTP requests
Services_Weather_Common::setUnitsFormat() Changes the representation of the units (standard/metric)
Returns IDs with location-name for a given country or all available countries, if no value was given (Previous) METAR has no forecast per se, so this function is just for compatibility purposes. (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.