River/Lake Height Display addon page for WD-AJAX-PHP-USA

This script will display your local data from the Advanced Hydrologic Prediction Service. Wxriverpage.php will give viewers an overall summary of local river/lake heights. Wxriverdetail.php will give a detailed look at a gauge, showing records, stages of flood, forecast, and recent observations.

Features:

  • Variable Display depending on what data is given
  • Colors changes with the stage.
  • Select amount of data shown.
  • Select scale on gauge images.
  • Option to choose location of images.
  • Map of current gauge states.
  • Reduce data downloads during calm times.

Version 3.11F - 1-Jun-2013 - Updated Read me, suggest reading. Added “background”; in the settings this needs to be set to you region. Also changed the summary page to match the new variables.
Version 3.10F - 31-May-2013 - Brought back the clickable map. Added black around icon for “Highest Forecasted Stage” to make it easier to read. Implemented new logic to reduce download rate when no rivers are calm. Added “Last Updated” time on the summary page. Changed arrows now they are based off of the last hour of data. The last hour (rise/fall) and the next hour (rise/fall) will show up when your mouse is held over the arrow.
Version 3.00F - 20-Apr-2013 - Removed clickable map. Added icon for “Highest Forecasted Stage”. Implemented new logic for both summary and detail to display data correctly. My clickable map is my on page using an iFrame, wxforum has a thread on how to do this. I will not be supporting this until I can get more time.
Version 2.15 - 28-Sept-2011 - Fixed clickable map, AHPS made a few more changes, causing the clickable map to not function properly.
Version 2.14 - 08-Sept-2011 - Fixed detail page so forecast shows up properly. Also summary page was fixed to show record flooding.
Version 2.13 - 11-May-2011 - Fixed a few Not Defined river errors. Also fixed stage/flow colors for certain conditions.
Version 2.12 - 21-Feb-2011 - Fix for name of river on details page. Changed names to AHPS standards. Added dropdown menu for details page.
Version 2.11 - 01-Jan-2011 - Fix for the clickable map. Now works with how the AHPS is doing the xml.
Version 2.10 - 20-Nov-2010 - Status of the Gauge will now show for those with rivers with only flow readings and flow records. All shorttags have been replaced with the full php tag.
Version 2.01 - 20-Sept-2010 - Fixed Clickable map so it will now work with lowercase gauge id’s. Fixed “Not Defined” error on gauges without an action stage. Also fixed other cosmetic issues.
Version 2.00 - 18-Sept-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.
Version 1.02 - 12-Sept-2010 - Added “Back to River Summary” on detail pages. Also other minor fixes.
Version 1.01 - 29-Aug-2010 - Fixed Not Defined Status on gauges without an action stage. Also fixes Negative flow, now displayed as N/A.
Version 1.00 - 29-Aug-2010 - Initial Release.

See it in action - http://eastmasonvilleweather.com/wxriverpage.php

Check for Updates/Download - http://eastmasonvilleweather.com/downloads.php

Nice script… Thanks for sharing it…

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

In this line in the config file, I had to change & to & so it would validate…

$currentstage = “http://water.weather.gov/ahps2/all_layer_merge.php?wfo=sew&layers=10,7,8,2,9,15,6”;

I just noticed that I released an older version.

Version 1.01 - Aug-29-2010 - Fixed Not Defined Status on gauges without an action stage. Also fixes Negative flow, now displayed as N/A.

and this version validates. Sorry about this guys.

Download at beginning of thread.

-Dennis

Cool script Dennis. Thanks for sharing.

Ok… What did I do wrong? :oops:
http://www.cavecountryweather.com/wxriverpage.php

Edit:
Got it now. I had to manually create the river-XXXX2.txt files and set the permissions.

Edit #2:
I merged your script with a clickable map I already had and added some wording at the bottom. Thanks for the great script!
http://www.cavecountryweather.com/riverlevel.php

#-o The river-xxxx2.txt files are almost 200KB each. 8O Keep that in mind with your fetch frequency and the number of gauges you are using.

Yeah these files are big, I have plans to change this so it does not use as much bandwidth. But classes start this week so this will have to do for the time being.

Drobbins, I like the click able map, nice addition.

-Dennis

Good Monday morning…I’ve set it all up per the instructions but am getting this…

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity “./River/river-.txt” in /virtual/users/e16478-17699/web/wxriverdetail.php on line 50

Chris,
It is looking for a file for each of you locations. Use notepad and just create blank files named river-XXXXX.txt. Replace the XXXXX with the gauge name (ALBK2 or whatever) then upload the files in to the River folder. File permissions should be set to 666.

Perfect…thats what I had thought but EACH time I think, I weaken society.!

Also, now I get an error saying curl statement on line 10 in river-fetch.php is invalid… can I use Windows Scheduler to run the fetch file???

thanks again.

Yeah you can use Windows Scheduler. It just needs to call that file to download the information.

-Dennis

Thanks again Dennis!!!

A suggestion. A back button to the main river page when viewing a river detail page,
a link back to the main river page. Other than that, perfect!

Tony 8)

Can anybody tell me what I did wrong. http://www.foresthillweather.com/wxriverpageB.php
I am not running it in a cron job in tell I get the script to work.

Thanks Scott

Hi Scott,

Right now I am not really sure what is up. I ran one of your gauges with my page and it worked fine. PM me your pages and I will take a look to see what is up.

-Dennis

Thank you Dennis for looking at this for me. I am at a Loss. I like what this script does.

This is the link to the river-fetch.php http://foresthillweather.com/River/river-fetch.php

The link to the river-config http://foresthillweather.com/River/river-config.php
and one of the txt it produced http://foresthillweather.com/River/river-BDBC1.txt

wxriverpage.php http://foresthillweather.com/wxriverpage.php
wxriverdetail.php http://foresthillweather.com/wxriverdetail.php

wxriverpage.php, wxriverdetail.php and river-config.php in a txt form of what I did
http://foresthillweather.com/River_txt/river-config.txt
http://foresthillweather.com/River_txt/wxriverdetail.txt
http://foresthillweather.com/River_txt/wxriverpage.txt

I then put wxriverpage.php and wxriverdetail.php in my templet which is called wxriverpageB.php and wxriverdetailB.php

I hope this is what you need

Thanks Scott

Just making sure…but you did change the permissions on the txt files…??

Hi Chris, I did not change the permissions on the txt files. I have no idea how to do that. Building this website
Has been a step by step learning experience. So How Would I change the permissions on the txt file.

Thanks Scott

Version 1.02 - Set-12-2010 - Added “Back to River Summary” on detail pages. Also other minor fixes.

Download at beginning of thread.

Scott, looking over your pages they all look ok. As for changing the file permissions I do mine in my ftp program. Maybe Chris knows a more general way to do it. The only thing that concerns me is the fact your stages show up, which is parsed from the txt file. I will keep looking at this more when I get my homework done. :lol:

-Dennis

Thanks Dennis

I figured out how to change the file permissions. I am using Dreamweaver CS3, It has you right click on the file and then you can set the permission. But it is not letting me change permission. I might have to change something in the server. My server uses CPanal.

Scott