cloudy cloudy

Author Topic: River/Lake Height Display addon page for WD-AJAX-PHP-USA  (Read 43213 times)

0 Members and 1 Guest are viewing this topic.

Offline EastMasonvilleWX

  • Posts: 252
  • Masonville, NY
    • East Masonville Weather
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #30 on: September 14, 2010, 07:35:18 PM »
I was able to take his code listed and have it show up on my server just fine. Im thinking it maybe a server issue.
East Masonville Weather
Upstate New York
http://eastmasonvilleweather.com


warwickpaweather

  • Guest
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #31 on: September 14, 2010, 07:37:58 PM »
yeah I think so...its displaying fine on my guage-page......I had to take out guage "BDBC1" as it was showing several errors on the page...OK I'm going back to my guages....

Offline EastMasonvilleWX

  • Posts: 252
  • Masonville, NY
    • East Masonville Weather
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #32 on: September 16, 2010, 05:06:13 AM »
Lee,

That is a pretty slick map you got there. I was going to search the AHPS site some more to see if they had "coordinates" on their maps.  Then I might be able to make the map click able with little effort.

-Dennis
East Masonville Weather
Upstate New York
http://eastmasonvilleweather.com


Blackjack52

  • Guest
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #33 on: September 16, 2010, 03:12:11 PM »
Thanks Dennis.
Unfortunately, there's no easy way to do it.

Here's my php. 1 setting to get the map url.
Then to get the map coords, goto the AHPS pg for your area and use View Source in your browser.

Offline fhweather

  • Posts: 14
    • foresthillweather.com
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #34 on: September 17, 2010, 03:32:37 AM »
Hey Dennis and Chris, I tried the Script on a different server I have, my dondelingerphotography.com site.
It works great on that server. So I need to get with the people at my foresthillweather.com site and hopefully get them to fix it. I thank you guys very much for your help.

Thanks again Scott     

warwickpaweather

  • Guest
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #35 on: September 18, 2010, 08:53:51 AM »
I see your flood guage page is up and running...what was the problem????

Offline fhweather

  • Posts: 14
    • foresthillweather.com
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #36 on: September 18, 2010, 04:42:49 PM »
Hi Chris and Dennis, The best way I can explain what they did is to pass the info they sent me via email.
 
This is what they sent me.
----------------------------------------------------------------------------------------------------
The problem does not seem to be with our server but with the PHP code
itself.

The PHP code (wxriverpage.php) uses simpleXML to parse the
river-XXX.txt files and breaks out the information in those XML into
different variables that are then used to generate the webpage based
on a bunch of if statements that uses math operations for comparisons.

The problem is that simpleXML returns values that are of type "Object"
and the comparisons utilize the number_format() function and this
function does not seem to know what to do with an "Object" variables.
So even though variables like $ObsStage seemed to have a valid integer
/ float value associated to it, number_format() would return a null or
something else that would make the comparisons invalid / wrong thus
generating the wrong results for the page output.

A simple fix was to convert the simpleXML objects to something that
number_format() likes so I update the code to convert all the
simpleXML objects to strings and the page now renders correctly.

Sample: Before

 $ObsStage = $xmlData["$riverid"]->observed->datum[0]->primary;

After:

 $ObsStage = (string)$xmlData["$riverid"]->observed->datum[0]->primary;

This seems to be a common issue coders run into when trying to use
math operations on variables created from simpleXML.

http://www.php.net/manual/en/book.simplexml.php#95762
http://www.php.net/manual/en/book.simplexml.php#94105

I'm not sure why the unmodified code seems to work on your other host
provider and not on our server but my guess is that our servers are
running different versions of PHP and they changed something between
versions.
-----------------------------------------------------------------------------------------

What I have is a big band aid on that script within the server to make it work. My server is running the lastest PHP which is PHP 5.3.3 The script worked fine on my go daddy server, but that was PHP 5.2.8  I am still curious if anybody else is running version PHP 5.3.3. with this script.
 
Dennis I like what you have done with Jim at Juneau County Weather on the clickable map. Let me know if you do get a fix for this, or something you want me to test on my server.  I will keep checking for updates. Also what this script does is so good it is well worth it.

Again thank you very much Scott
   
 

Offline EastMasonvilleWX

  • Posts: 252
  • Masonville, NY
    • East Masonville Weather
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #37 on: September 19, 2010, 02:02:00 AM »
Version 2.00 - Set-18-2010 - Big changes, Clickable map- Thanks to Jim, also added the ability to put the images at the top or the bottom of the page. Hopefully fixed the script for the newest version of PHP.

Download at beginning of thread.

I would also like to apologize to everyone, I have been writing this between my computer at home and my computer at school.  When writing new versions, sometimes improvements are left out that were incorporated in older versions.  This version should have all the good stuff listed on the site.

-Dennis
East Masonville Weather
Upstate New York
http://eastmasonvilleweather.com


Blackjack52

  • Guest
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #38 on: September 19, 2010, 05:12:28 AM »
Version 2.00 - Set-18-2010 - Big changes, Clickable map- Thanks to Jim, also added the ability to put the images at the top or the bottom of the page. Hopefully fixed the script for the newest version of PHP.

Download at beginning of thread.

I would also like to apologize to everyone, I have been writing this between my computer at home and my computer at school.  When writing new versions, sometimes improvements are left out that were incorporated in older versions.  This version should have all the good stuff listed on the site.

-Dennis

Glad to offer this idea for huge improvement along with code for map.

Offline jmcmurry

  • Jim McMurry
  • Posts: 2,836
  • Mauston, WI, USA
    • Juneau County Weather
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #39 on: September 19, 2010, 10:24:18 AM »
Lee,

You're right, your code is what got me thinking about it.  The new version now scrapes the code from the AHPS site so that the mouseovers are always current.

Dennis,

I don't think your changes made it to the download .zip because the most recent dates in there are the 12th.

- Jim

Forum Search and Google can be your best friends

Offline EastMasonvilleWX

  • Posts: 252
  • Masonville, NY
    • East Masonville Weather
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #40 on: September 19, 2010, 01:03:17 PM »
Jim,

I think your right...doing too many things at the same time.

Now it is uploaded everyone.

Lee,

Thanks for giving us a starting point with the clickable map.

-Dennis
« Last Edit: September 19, 2010, 01:09:33 PM by clappy9 »
East Masonville Weather
Upstate New York
http://eastmasonvilleweather.com


Offline CNYWeather

  • Professional Trophymaker!
  • Posts: 1,521
  • Rome, New York
    • CNYWeather.com
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #41 on: September 19, 2010, 02:19:11 PM »
Thanks for the update guys! Works great

Tony  8)
Tony

CNYWeather.com
CWOP: CW2352
WeatherUnderground: KNYWESTM1


http://www.CNYWeather.com

I Make Trophies Too!
http://www.speedyawards.com

warwickpaweather

  • Guest
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #42 on: September 19, 2010, 03:41:30 PM »
Good day...I replaced the URL with my local clickable image, replaced what was needed in "river-fetch.php" and reuploaded.......th emap isn't displaying...was the URL suppose to be replace elsewhere also??

Offline CNYWeather

  • Professional Trophymaker!
  • Posts: 1,521
  • Rome, New York
    • CNYWeather.com
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #43 on: September 19, 2010, 04:08:57 PM »
Has the cron job river-config run yet? I ran mine after I installed everything
and it was a-ok.

Tony

CNYWeather.com
CWOP: CW2352
WeatherUnderground: KNYWESTM1


http://www.CNYWeather.com

I Make Trophies Too!
http://www.speedyawards.com

warwickpaweather

  • Guest
Re: River/Lake Height Display addon page for WD-AJAX-PHP-USA
« Reply #44 on: September 19, 2010, 04:17:11 PM »
Yeah it ran..the map is displaying but its not click-able...


http://www.bucksweather.com/wxriverpage.php