Re: [RfC] Services_Weather
| From: | Yavor Shahpasov | Date: | Fri, 03 Oct 2003 09:01:41 +0000 |
| Subject: | Re: [RfC] Services_Weather | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22342@lists.php.net to get a copy of this message | ||
Hello
A long way back I proposed a similar class, based on the code from
phpweather project. Here are some comments
it has the metar data url hard coded
"http://weather.noaa.gov/pub/data/observations/metar/stations/".$id.".TXT"
I might want to have a local data source th e weather.noaa.gov server is
not very reliable
it requires a data base, I don't see why I have to setup a database to
use this, it is an extra layer of complexity which increases the
difficulty, and even if you do allow it it should have the option of
passing a existing database connection. Maybe changing the parameters to
a single string/object with dsn or database object.
I believe metar parsing should be disconnected from database access,
maybe you could have a backend class which parses the metar data, the
url should be configurable and not hard coded, it should allow for a
data string and a local file o be passed also. If you must have the
database stuff it should use the class above the do the parsing. It
would be nice if you could distribute images (for weather conditions)
maybe as a subpackage, and return a valid image for the location, also
the prefix of the image should be configurable
Although it might be useless for you am attaching my class if you want
to have a look at it. the metart parsing is borrowed from the phpweather
project
http://phpweather.sourceforge.net/
Yavor
Arnaud Limbourg wrote:
>Hi,
>
>The classes look great.
>
>Stuff i would change
>
>Why use multiple parameters in (Metar)
>
> function setMetarDB($dbType, $dbUser, $dbPass, $dbHost, $dbName, $dbOptions)
> {
> $dsn =
> $dbType."://".$dbUser.":".$dbPass."@".$dbHost."/".$dbName;
> $dsninfo = array(
> "phptype" => $dbType,
> "username" => $dbUser,
> "password" => $dbPass,
> "hostspec" => $dbHost,
> "database" => $dbName,
> "mode" => 0644
> );
>
>when passing the dsn as a string would do the trick ?
>
>To follow CS i would also change the return TRUE and such to lower case (true/false).
>
>Arnaud.
>
>
>
>>Hi folks,
>>
>>after the suggestions from last time I proposed Science_Weather, I redid
>>the whole idea and came up with the stuff you can find at
>>http://www.pc4p.net/pear/Services_Weather/
>>For now I'd like to ask for a first review, there will be some stupid
>>stuff in there, despite my reviews so far, so please comment or make
>>suggestions, if you find something fishy.
>>
>>If anything goes well, I will CfV asap...
>>
>>
>
>
>
--
Yavor Shahpasov
yavo@siava.org