Author Topic: yr.no forecasts worldwide-script  (Read 30507 times)

0 Members and 1 Guest are viewing this topic.

Offline weatherc

  • Senior Contributor
  • ****
  • Posts: 278
yr.no forecasts worldwide-script
« on: October 22, 2011, 04:21:55 AM »
Hi all!

Updated the yr.no-script so now its possible to search for 3.3 million forecasts in 240 countries :lol:

- Shows nearby webcams by Webcam travel
- Possibity to save favorite location
- It use geonames.org FREE webservice (Sign up required)
- If webserver have geotags like $_SERVER["HTTP_GEOIP_LONGITUDE"] it use that to get default location

Live demo: http://www.nordicweather.net/yrnoennuste.php?en
Download: http://www.nordicweather.net/downloads/?5

 :grin:

// Henkka

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2295
    • CNYWeather
Re: yr.no forecasts worldwide-script
« Reply #1 on: October 22, 2011, 08:25:05 AM »
There's an error on your demo page Henka

Code: [Select]
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /var/www/vhosts/nordicweather.net/httpdocs/scripts/yr_xmlII.php on line 139
Tony




Offline weatherc

  • Senior Contributor
  • ****
  • Posts: 278
Re: yr.no forecasts worldwide-script
« Reply #2 on: October 22, 2011, 11:10:48 AM »
Quote
There's an error on your demo page Henka

I don't see the error here.
I *think* its the autolocator for the default forecast what use geoip what fail for some reason, shouldn't affect the usage of the search tought.

// Henkka

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2295
    • CNYWeather
Re: yr.no forecasts worldwide-script
« Reply #3 on: October 22, 2011, 11:27:49 AM »
That demo page wont fill in anything on the auto select Henka

Tony




Offline weatherc

  • Senior Contributor
  • ****
  • Posts: 278
Re: yr.no forecasts worldwide-script
« Reply #4 on: October 22, 2011, 12:21:39 PM »
Works fine here. There are no "Utica, NY" hit in the database tought.
Just write say Uti and hits are as attached.

You can test also this one: http://www.nordicweather.net/test/yr/yrtest.php
It has predefined default as Helsinki like the zip has. That my version use the geoip Nginx/PHP-thingy for that.

Henkka
« Last Edit: October 22, 2011, 12:24:14 PM by weatherc »

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2295
    • CNYWeather
Re: yr.no forecasts worldwide-script
« Reply #5 on: October 22, 2011, 12:28:55 PM »
Getting there. A few issues.

I'm not able to display imperial units on anything except wind which is mph.

Temp and precip are C and MM

http://bit.ly/r0Ussc


Thank you!
« Last Edit: October 22, 2011, 01:10:01 PM by CNYWeather »
Tony




Offline jay_hoehn

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 656
    • Jay's Woodcrafts
Re: yr.no forecasts worldwide-script
« Reply #6 on: October 22, 2011, 03:16:44 PM »
Tony and Henkka,

I am also trying out the script.  I also can't get it to change the temp to F and pressure to inHg.  I am also trying to change the date format to d.m.y and that doesn't work.  I also can't get the default location to set.

See it here: http://www.jayswoodfurniture.com/wx/worldfor/yrtest.php

Thanks,

Jay
Davis Vantage Pro2 Plus
VVP
Weather Display


Offline mava

  • Member
  • *
  • Posts: 22
    • mavahome
Re: yr.no forecasts worldwide-script
« Reply #7 on: October 23, 2011, 07:51:22 AM »
Hi,
Almost there....

I have a problem getting the default place to show.
Works fine when I choose country and place. Its just the default place not working.

My settings :

// Timesettings, normal PHP/date-tags used
$datestyle = "d.m.Y";      // Style of short date
$timestyle = "H:i";      // Style of time
$longdate = "d.m.Y H:i";   // Style of long time + date
$deftz = "Europe/Oslo";
$pagename = "wxyr2.php";

$geonameusr = "mava2"; // IMPORTANT! You need to signup at geonames.org (FREE), put username here

// Cachesettings etc. settings
$qarefetchSeconds = 3600;   // How often it refresh the cache, 3600 recommended
$imgdir = "yr2/images/";   // Icons-folder
$jsfolder = "yr2/jquery/";
$cssfolder = "yr2/css/";
$cachefolder = "yr2/cache/";
$days = array('søndag','mandag','tirsdag','onsdag','torsdag','fredag','lørdag');

// Default place
$cod = "NO";
$cou = "Norway";
$cit = "%C3%85lg%C3%A5rd";  << Have tried to use  : Ålgård and Ã…lgÃ¥rd without any luck
$lat = 58.76417;
$lon = 5.85253;

http://www.mavahome.com/wxyr2.php

rgs

Offline Bunty

  • Forecaster
  • *****
  • Posts: 2429
  • Stillwater, home of Oklahoma State University
    • Welcome to Stillwater Weather
Re: yr.no forecasts worldwide-script
« Reply #8 on: October 25, 2011, 01:53:11 AM »
Getting there. A few issues.

I'm not able to display imperial units on anything except wind which is mph.

Temp and precip are C and MM

http://bit.ly/r0Ussc


Thank you!

I'm having the same problems.   Since it's, otherwise, impressive, I hope it gets fixed.

Also the 2nd home page using modified AltDashboard 6.95 at http://stillwaterweather.com/2ndhome.php

Offline i_fiorentino

  • Forecaster
  • *****
  • Posts: 562
  • Davis Vantage Vue, Boltek Stormtr., Mobotix M22-IT
    • Meteopistoia.it
Re: yr.no forecasts worldwide-script
« Reply #9 on: October 29, 2011, 12:50:23 PM »
Hi,
Almost there....

I have a problem getting the default place to show.
Works fine when I choose country and place. Its just the default place not working.

My settings :

// Timesettings, normal PHP/date-tags used
$datestyle = "d.m.Y";      // Style of short date
$timestyle = "H:i";      // Style of time
$longdate = "d.m.Y H:i";   // Style of long time + date
$deftz = "Europe/Rome";
$pagename = "yrtest.php";

$geonameusr = "i_fiorentino"; // IMPORTANT! You need to signup at geonames.org (FREE), put username here

// Cachesettings etc. settings
$qarefetchSeconds = 7200;   // How often it refresh the cache, 3600 recommended
$imgdir = "./images/";   // Icons-folder
$jsfolder = "./jquery/";
$cssfolder = "./css/";
$cachefolder = "./cache/";
$days = array('Domenica','Luned&igrave;','Marted&igrave;','Mercoled&igrave;','Gioved&igrave;','Venerd&igrave;','Sabato');

// Default place
$cod = "IT";
$cou = "Italy";
$cit = "Carmignano";
$lat = 43.80443;
$lon = 11.02722;

Same problem here: http://www.meteocarmignano.it/wxysforecast_test.php
No weather forecasts on my page with default place.
Possibile geotag issue? How does it work?

Thanks in advance,

Alessandro
« Last Edit: October 31, 2011, 10:20:54 AM by i_fiorentino »

Offline edje1205

  • Member
  • *
  • Posts: 6
Re: yr.no forecasts worldwide-script
« Reply #10 on: October 30, 2011, 12:20:36 PM »
Hi Henkka

Another marvelous script  :grin:

Almost got it to work, but unfortunately no graphics and buttons at the page
http://www.weersverwachtingen.eu/clientraw/wd-ajax-ml/wxyrglobal.php?nl|52.392153883603726|4.943418502807617|Europe/Amsterdam|Nieuwendam|Netherlands|NL

Is there any  root for the script ? think something went wrong in the paths
yr_xmlII.php and yrdb.php are at www.weersverwachtingen.eu/clientraw/wd-ajax-ml/scripts

settings as attached

maybe you can give me a clue ?

thnx so far

Offline edje1205

  • Member
  • *
  • Posts: 6
Re: yr.no forecasts worldwide-script
« Reply #11 on: October 31, 2011, 10:01:16 AM »
Hi all,

Got it to work !  :grin:
with try and error, changing paths (1000x  :shock: #-o) etc etc
settings see att (FWIW)

Only my startpage has no place and country in it
http://www.weersverwachtingen.eu/clientraw/wd-ajax-ml/wxyrglobal2.php

any suggestions ?

thnx for the script Henkka
« Last Edit: October 31, 2011, 10:03:29 AM by edje1205 »

Offline i_fiorentino

  • Forecaster
  • *****
  • Posts: 562
  • Davis Vantage Vue, Boltek Stormtr., Mobotix M22-IT
    • Meteopistoia.it
Re: yr.no forecasts worldwide-script
« Reply #12 on: October 31, 2011, 10:23:20 AM »
Hi Edje,
i've the same problem here: http://www.meteocarmignano.it/wxysforecast_test.php
The script doesn't find the default place.
Probably geoip issue?
« Last Edit: October 31, 2011, 10:28:00 AM by i_fiorentino »

Offline edje1205

  • Member
  • *
  • Posts: 6
Re: yr.no forecasts worldwide-script
« Reply #13 on: October 31, 2011, 11:56:25 AM »

...or cookie yrfav-fi is not created !?

had a while the page as favorite ; then
set cache expire at 3600 and it was gone after an hour !

 :shock: :roll:

edit: cookie created only shows: settings style / widescreen on or off
« Last Edit: October 31, 2011, 03:39:06 PM by edje1205 »

Offline mickopla

  • Forecaster
  • *****
  • Posts: 358
    • Waterford City Weather
Re: yr.no forecasts worldwide-script
« Reply #14 on: December 16, 2011, 01:50:41 AM »
Is there any step by step guide to get this script working as i have tried the last few days with no luck? I followed the README but its very limited. Here is what i have so far http://www.waterfordcityweather.com/yrtest.php Thanks in Advance

Mick

Offline mickopla

  • Forecaster
  • *****
  • Posts: 358
    • Waterford City Weather
Re: yr.no forecasts worldwide-script
« Reply #15 on: December 17, 2011, 10:19:39 PM »
Got the script to work but default location is blank. Also i have no weather symbols to depict sunshine cloudy ext. So close to getting this working. Shame there is no real support forum for this.

www.waterfordcityweather.com/yrtest.php

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: yr.no forecasts worldwide-script
« Reply #16 on: December 18, 2011, 06:15:47 PM »
Mostly the same problems as everybody else - date is backwards (d.m rather than m.d), units are Metric rather than Imperial, time is not local, favorite won't set, etc. Pressure shows inHg, but the data is actually hPa. Really enjoy your scripts, but this one won't budge no matter what I do to the config.

http://tiggrweather.net/yr/yrtest.php

Thanks.
« Last Edit: December 18, 2011, 06:21:21 PM by jgillett »
John
W7JKG

Offline Bunty

  • Forecaster
  • *****
  • Posts: 2429
  • Stillwater, home of Oklahoma State University
    • Welcome to Stillwater Weather
Re: yr.no forecasts worldwide-script
« Reply #17 on: December 19, 2011, 02:09:32 AM »
I  guess it's still in beta.

Also the 2nd home page using modified AltDashboard 6.95 at http://stillwaterweather.com/2ndhome.php

Offline mickopla

  • Forecaster
  • *****
  • Posts: 358
    • Waterford City Weather
Re: yr.no forecasts worldwide-script
« Reply #18 on: December 19, 2011, 04:16:34 AM »
Mostly the same problems as everybody else - date is backwards (d.m rather than m.d), units are Metric rather than Imperial, time is not local, favorite won't set, etc. Pressure shows inHg, but the data is actually hPa. Really enjoy your scripts, but this one won't budge no matter what I do to the config.

http://tiggrweather.net/yr/yrtest.php

Thanks.

You have the buttons and weather icons working which i can't manage do. I am putting the .png files provided in the images folder of my server but only the big numbers( which are in the same folder)are working. If i had the icons working i'd be happy enough to go live with it on my website. Any guidance on how you got the icons to work??
Cheers

Mick

Offline illice

  • Member
  • *
  • Posts: 4
    • El Tiempo en Elche
Re: yr.no forecasts worldwide-script
« Reply #19 on: December 19, 2011, 04:58:22 AM »
Hello
Someone can help me, I can not work properly.

// Units
$useC = 1;      // Use Celsius, else F
$useKMH = 0;      // Use Km/h
$useMPH = 0;      // Use Mph, if both KMH and MPH is zero is default m/s used
$useHPA = 1;      // Use hPa, else inHg
$useMM= 1;      // Use mm, else in

// Timesettings, normal PHP/date-tags used
$datestyle = "d.m.Y";      // Style of short date
$timestyle = "H:i";      // Style of time
$longdate = "d.m.Y H:i";   // Style of long time + date
$deftz = "Europe/Madrid";
$pagename = "yrtest.php";

$geonameusr = "illice"; // IMPORTANT! You need to signup at geonames.org (FREE), put username here

// Cachesettings etc. settings
$qarefetchSeconds = 7200;   // How often it refresh the cache, 3600 recommended
$imgdir = "images/";   // Icons-folder
$jsfolder = "jquery/";
$cssfolder = "css/";
$cachefolder = "cache/";
$days = array('Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai');

// Default place
$cod = "Es";
$cou = "Spain";
$cit = "Elche";
$lat = "38.26";
$lon = "-0.7";

http://www.meteoillice.es/yrtest.php

Thanks

Offline edje1205

  • Member
  • *
  • Posts: 6
Re: yr.no forecasts worldwide-script
« Reply #20 on: December 19, 2011, 05:02:59 AM »


hi
send this pM to Mick:

I started in yr_xmlII.php with:

ini_set('display_errors', '1');

for cache/paths I have:

// Cachesettings etc. settings
$qarefetchSeconds = 3600;   // How often it refresh the cache, 3600 recommended
$imgdir = "images2/";   // Icons-folder
$jsfolder = "jquery/";
$cssfolder = "scripts/css/";
$cachefolder = "/var/www/vhosts/weersverwachtingen.eu/httpdocs/cache/";




....and here (around line 146 ) in yr_xmlII.php I filled in my station lat/lon

date_default_timezone_set($tz);
$qacacheName = $cachefolder.md5($lat.$lon).'.xml';
$URLS = "http://api.yr.no/weatherapi/locationforecast/1.8/?lat=52.4385368327251&lon=4.8264312744140625";   // URL to the ENGLISH page on yr.no where location is

were the lat/lon is my station so find out

hope this helps

Offline mickopla

  • Forecaster
  • *****
  • Posts: 358
    • Waterford City Weather
Re: yr.no forecasts worldwide-script
« Reply #21 on: December 19, 2011, 06:52:41 AM »


hi
send this pM to Mick:

I started in yr_xmlII.php with:

ini_set('display_errors', '1');

for cache/paths I have:

// Cachesettings etc. settings
$qarefetchSeconds = 3600;   // How often it refresh the cache, 3600 recommended
$imgdir = "images2/";   // Icons-folder
$jsfolder = "jquery/";
$cssfolder = "scripts/css/";
$cachefolder = "/var/www/vhosts/weersverwachtingen.eu/httpdocs/cache/";




....and here (around line 146 ) in yr_xmlII.php I filled in my station lat/lon

date_default_timezone_set($tz);
$qacacheName = $cachefolder.md5($lat.$lon).'.xml';
$URLS = "http://api.yr.no/weatherapi/locationforecast/1.8/?lat=52.4385368327251&lon=4.8264312744140625";   // URL to the ENGLISH page on yr.no where location is

were the lat/lon is my station so find out

hope this helps

Cheers for the reply. I was checking on your website again and discovered that no matter what location is entered the forecast details are the same. I think this is happening because you entered the lat and lon on line 146.
One thing is puzzling me. In the images folder i have the bignums subfolder and 6 .png files. The icons are images contained in the png files. How can these be extracted? Do i need to create the icons in .gif form? Thanks again

Mick

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: yr.no forecasts worldwide-script
« Reply #22 on: December 19, 2011, 10:43:03 AM »
You have the buttons and weather icons working which i can't manage do. I am putting the .png files provided in the images folder of my server...

Since you moved the images to a different location than they originally came in (in the .zip), you've probably got a path problem. I just uploaded the entire /yr/ folder and had no problems at all, since the path provided in the script is looking for /images/ to be within /yr/.
John
W7JKG

Offline mickopla

  • Forecaster
  • *****
  • Posts: 358
    • Waterford City Weather
Re: yr.no forecasts worldwide-script
« Reply #23 on: December 19, 2011, 11:37:13 AM »
You have the buttons and weather icons working which i can't manage do. I am putting the .png files provided in the images folder of my server...

Since you moved the images to a different location than they originally came in (in the .zip), you've probably got a path problem. I just uploaded the entire /yr/ folder and had no problems at all, since the path provided in the script is looking for /images/ to be within /yr/.

That fixed the problem, Thanks so much  :grin:

Mick

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1187
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: yr.no forecasts worldwide-script
« Reply #24 on: December 19, 2011, 11:09:50 PM »
That fixed the problem, Thanks so much  :grin:

My pleasure.
John
W7JKG