Thread

Posted on Mon Apr 11 18:56:25 2005 by matsk
City selection
Hi, I'm programming a "Weather to Voice" script based on weather::com.

I have a problem with defining the city according to the output from the example in the "Weather::Simple".

The locations output from the example in "Weather::Simple" shows 'New York/Central Park, NY', but if I use it, it fails if I use that as the input to "weather.pl".

./weather.pl

Welcome to Uncle Tom's weather station...
This is V1.012

Please enter a location name to look for, e.g
'Heidelberg' or 'Seattle, WA', or 'Munich, Germany'

$ New York/Central Park, NY
No weather found for location 'New York/Central Park, NY'

But,
$ Central Park, NY
Found weather data for 1 locations:
is successful.

Is there a way to use the full string 'New York/Central Park, NY' as location ?

/Mats
Direct Responses: 325 | Write a response
Posted on Mon Apr 11 21:10:41 2005 by schnueck in response to 322
Re: City selection
Maybe that's a problem with encoding the '/' to a web-url-able format.... I'll check this asap.

Thomas
Direct Responses: 336 | Write a response
Posted on Thu Apr 14 14:30:11 2005 by schnueck in response to 325
Re: City selection
Hi,

I tested this by hand...

If you call for 'http://xoap.weather.com/search/search?where=New%20York%2FCentral%20Park%2C%20NY' this would be the perfectly URL encoded string to search for 'New York/Central Park, NY'.

BUT, this does not return any result. Only an empty search message. Seems that this is a problem with the XOAP server on weather.com's side.

I'll implement following workaround with the next release:
For now, if one searches for a location 'New York' the location cache stores the following hash:
$locations = { 'New York' => [ "USNY0996", # New York, NY "USNY0998", # New York/Central Park, NY "USNY0999", # New York/JFK Intl Arpt, NY "USNY1000", # New York/La Guardia Arpt, NY ], }

With 0.4 this should be
$locations = { 'New York' => [ "USNY0996", # New York, NY "USNY0998", # New York/Central Park, NY "USNY0999", # New York/JFK Intl Arpt, NY "USNY1000", # New York/La Guardia Arpt, NY ], 'New York, NY' => [ "USNY0996", # New York, NY ], 'New York/Central Park, NY' => [ "USNY0998", # New York/Central Park, NY ], 'New York/JFK Intl Arpt, NY' => [ "USNY0999", # New York/JFK Intl Arpt, NY ], 'New York/La Guardia Arpt, NY' => [ "USNY1000", # New York/La Guardia Arpt, NY ], }

This will cause any search for 'New York/La Guardia Arpt, NY' after having once searched for 'New York' to work.

Thomas
Direct Responses: 337 | Write a response
Posted on Thu Apr 14 14:42:47 2005 by schnueck in response to 336
Re: City selection
Perhaps, one has the time to put all big cities in a file, e.g.

Berlin New York Sidney

I'll do a location search for all this cities with the new location cache mechanism and then I can ship a pre-configured 'locations.dat' with the next release...

Thomas
Direct Responses: 345 | Write a response
Posted on Fri Apr 15 02:52:11 2005 by schnueck in response to 337
Re: City selection
It's done...

I reworked the location caching mechanism and the way the location search works.
I's know possible to search for a 'slashed' location (e.g. 'New York/Central Park') as soon as it has been put into the locations cache (e.g. by searching for 'New York').

This also allow to search for something like 'new york/central' to get the Central Park weather back.

You can test this upcoming feature together with the new internationalization/translation support with the current PRE release 0.4_pre2
The pre release will not be put on CPAN! I think it will take some additional time for the translation stuff before I can release a V0.4 release.

Please report any bugs concerning this pre release directly to me by email or to this forum. If you want to help with translation to other languages mail me, too.
Thomas
Write a response