Tuesday, October 30, 2007

Pre-Halloween stuff

I uploaded new versions of the following files:

ks1cams.txt
ks1cambat.txt
ne1cams.txt
ne1cambat.txt

I found a new camera near Topeka to add and an old one in Madison (south of Emporia). The latter had gone down several months ago and is now back up.

The McCook, NE camera is still down after a couple of weeks. I took it out of the script and added two new ones.

Tuesday, October 23, 2007

More camera updates

It looks like whatever problems cotrip.org was having Sunday morning are over. I couldn't get any images at all from the web cameras link. It kind of sucked at the time, with the thundersnow going on in west Denver!

I did find some other cameras though and the snow was really coming down! You gotta love technology!

I'll be rather busy the next couple of days so I doubt if I get any updates done. I did run the main "gr3cam.bat" script this morning and it appears every link worked with the exception of the camera in McCook, NE. I also had an incomplete image from one of the cameras from OKC.

Friday, October 12, 2007

Thank you!

Well, my new post on the GRLevelX forum has had about 70 views since Wednesday. That's not bad considering I hadn't done major work on the web cam project since April. Thank you for taking a look at the updates and the new page. I hope you've enjoyed the visit.

Wednesday, October 10, 2007

Camera updates

I noticed this morning as I was updating things that a few cameras are down. Most of the issues concern the Cotrip.org cameras and a few from KJRH and KCTV.

I'm not sure what's up (server issues?) but I will leave the scripts unchanged for now. I'd hate to change a bunch of things and then have to change them back just for a temporary hiccup.

New look to my GRLevel3 Page!

I decided recently to give my GRLevel3 web page a facelift! I moved all of my GRLevel3 related work from my "cox.net" based page to what you see now here on Blogger. The good news is that I can now post new work much faster and it's a much cleaner look! I hope you like it!

That said, I am still using part of the old cox.net based page for storing the placefiles and batch files for the GRLevel3 Live Webcam Project. If needed, I can store important pictures there too or use it for other future needs.

I'm happy to report that I have updated all of the placefiles and batch files in the last week. I had found some links that were outdated and some cameras that just did not work anymore. In addition, I have added some cameras from Colorado and Missouri. Please look on the right side of your screen under "The Live GRLevel3 Webcam Project Links" to find these links.

Any questions or comments, please let me know!!

Rodney

Background to the "GRLevel3 Live Webcam Project"


I started the GRLevel3 Live Web Project (GR3LWCP) in late summer 2006. Ever since Placefiles were introduced to GRLevel3, I wanted to figure out some way to add web cam pictures on the radar screen, much like what is done on the web page "WeatherBonk". Once I felt I had a decent understanding of placefiles, I went to work.

Here is a list of the programs you'll need:

GRLevel3 (goes without saying)
URL2File
ImageMagick
Google Earth

URL2File is a free 32bit Windows console-mode application able to retrieve and save the content of a given World Wide Web or FTP URL to a local file. (quoted right from their web page). In other words, using a DOS window, you can type in some simple commands to grab the file you want and save it directly to your computer. This program is a very small file, less than 500K.

ImageMagick is a software suite to create, edit, and compose images. The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite programming language. (quoted from their web page). This is a much larger download, about 15Mb.

Google Earth was used to find the lat/lon of the cameras' location.

Getting started!

The first thing I had to do was download URL2File and ImageMagick. I saved URL2File to my computer: C:\Program Files\GRLevelX\GRLevel3.

Next, I installed ImageMagick onto my computer (e.g. C:\Program Files\ImageMagick-6.2.9-Q16). (editor's note: this was the current version when I first started this project. It has since been updated!)

Next, I had to find the raw images to import. My search started here in Kansas, looking for web cams at TV stations, schools, etc. However, I didn't want to save the web page, just the raw image from the web cam (whatever format is used.) For example, there is a camera in Lawrence that I found at this site:

http://www.lawrence.com/downloads/webcams

In doing a little sniffing around, I found the raw image:

http://etc.lawrence.com/webcam/tower.cgi

This search went on and on until I found a decent amount of web cams.

Creating Files:

First we'll need a .bat file that will not only download/save the images, but also process them using ImageMagick into a format that GRLevel3 can use. I wrote webcam.bat and placed it a new folder where GRLevel3 is located. It is:

C:\Program Files\GRLevelX\GRLevel3\pictures

For instructional purposes, the original webcam.bat file looked something like this:

del *.jpg
del *.png

URL2File http://media.mgbg.com/kwch/images2/towercam/kwchtower.jpg kwch.jpg
URL2File http://media.49abcnews.com/img/webcam/axis0.jpg ktka.jpg
URL2File http://etc.lawrence.com/webcam/tower.cgi klwc.jpg

convert kwch.jpg -resize 120x90! kwch.png
convert ktka.jpg -resize 120x90! ktka.png
convert klwc.jpg -resize 120x90! klwc.png

convert kwch.png ktka.png klwc.png +append -matte webcam1.png

You'll notice that in this DOS-based script, I first delete all of the old images (jpg/png) in this folder, then start the download.

URL2File http://etc.lawrence.com/webcam/tower.cgi klwc.jpg

In this line for example, URL2File goes to the lawrence.com web site and downloads the picture, saving it as "klwc.jpg". After it downloads all of the new images, it then converts them using ImageMagick. For example:

convert klwc.jpg -resize 120x90! klwc.png

This line tells ImageMagick to convert klwc.jpg to a 120x90 .png file titled klwc.png.

The final line:

convert kwch.png ktka.png klwc.png +append -matte webcam1.png

...takes all of the new, resized .png files and in the order I programmed, arranges them from left to right, adds an alpha channel and saves it as webcam1.png. I don't want to bore you with a complete tutorial of ImageMagick. Heck, there's much more **I** need to learn. For more, please visit their web page.

Next, we'll need a placefile to display these web images. I created yet another folder (C:\Program Files\GRLevelX\GRLevel3\places) to put all of my custom placefiles in.

Here's what the very first web cam placefile looked like:

;gr3webcam.txt Verison 0.1
;Placefile for GRLevel3 by Rodney Price, 09/06/06
;updated 9/12/06
Refresh: 2
Title: KS/MO/OK Web cams
Threshold: 500

Color: 200 200 255

IconFile: 1, 120, 90, 60, 45,"C:\Program Files\GRLevelX\GRLevel3\pictures\webcam1.png"
Font: 1, 11, 1, "Arial"

Icon: 37.75093, -97.303882, 0,1,1, "KWCH Web Cam"
Icon: 39.027859, -95.748661, 0,1,2, "KTKA Web Cam"
Icon: 38.973357, -95.235810, 0,1,3, "Lawrence Web Cam"
End:

I created a shortcut on my desktop for webcam.bat. It's not an automatic script. I just run it periodically when I want to as GRLevel3 is up and running.

When everything is up and running, the picture at the top of the post is what it will look similar to.

I'm sure more advanced users could whip up something along the same lines using PHP for example. I just wanted to develop something simple that I could use without learning a new programming language! It's not the most extravagant placefile but maybe it can be of use to some folks.

One drawback to this approach: if one of the web cameras in the script is down, then all of the cameras immediately following it will be plotted in the wrong location. For example, if camera 2 is down, when the image from camera 3 loads, it will be plotted in the camera 2 location (and so on and so forth.)

IMPORTANT EDITOR'S NOTE: On any of the batch files ending with "bat.txt", be sure to change the name so that the extension is ".bat" instead. For example, ks1cambat.txt should be changed to ks1cam.bat. That way your computer knows it's a batch file and will run the program correctly.

ALSO! If you are running the scripts separately (instead of using "gr3cam.bat"), be sure to run ks1cam.bat first as it has the "del *.jpg" and "del *.png" commands at the top of the script. Or, simply delete those 2 lines of code out of the script. Your call.