Realtime NexStorm Lightning Display
NSDisplay is a very configurable display of NexStorm lightning data that utilizes javascript for periodic updates. It is nearly "Plug and Play" if you set things up following these instructions. If you wish to install to different folders, just change the path information in the configuration file. Once you have it running feel free to alter the "looks" by changing portions of the css if you wish. But don't forget to try all of the many different display options to find the setup that suits you best.
Requirements
Boltek Lightning DetectorNexStorm Software (with the Flashgate IPC enabled)
NSLog software
JpGraph PHP software
Included files
| NSdisplay.php | - | The main file that is included in your web page | |
| NSconfig-inc.php | - | The single point configuration file | |
| NSajax.js | - | Javascript file for the updates | |
| NStracreportshort-inc.php | - | Used by the script to generate the Trac info | |
| NStracajax.php | - | Support file so we can access the trac report script from both PHP and Javascript | |
| NSplotstrikes.php | - | Calculates map position when the "Plot Last Strike" option is used | |
| NSlang-inc.php | - | Language translation file | |
| NSstyle.css | - | CSS for the project | |
| BarGraph.php | - | Used by the script to create the small bar graphs | |
| strikes.php | - | JpGraph to display total strikes | |
| strikes2.php | - | JpGraph to display both total strikes and strikes by type | |
| wasp105.php | - | PHP script to create a small version of your Wasp2 image | |
| NSTestStrict.php | - | Test page and sample of how to include in your page | |
| *.png | - | Various graphics used by the script | |
| ariali.ttf | - | Font file used by JpGraph for the strikes.php files |
This distribution is designed to be used with either a 541x541 px (NexStorm display set at 800x600) or 691 px (NexStorm display set at 1024x764) image from Nextorm, and it detects the size of map automatically. Set Nexstorm to create only the map, no right sidebar or legend are needed on the image. If you are using the Carterlake AJAX template set in narrow mode and wish for this one page to be wide in order to use the larger image, follow the directions here.
Download
You can download the script here:
NSdisplay.zip
( Size:
174.26 KB Updated:
01.04.2010)
Instructions
Setting up NSLog
NSLog is a small utility program that reads the NexStorm™ Flashgate IPC memory area and then creates files suitable for enabling javascript updates of web pages as well as the creation of graphs. It also has the option to upload several files at user-defined rates, which will then be accelerated when a user-defined level of lightning activity is reached. NSLog created files are the data that NSDisplay uses. Consider using NSLog to handle the uploads of your NexStorm image, Wasp2 image (if you use it) and TRAC info too because it will upload on a schedule, and only upload if the file is newer than the last one uploaded.
Create a /lightning/ folder just below the root of your web site and set NSLog to send all uploads there. NSLog download and instructions can be found here: NSLog Download
Setting Up The Script
Open up NSconfig-inc and choose your settings. Everything is well commented there, so the options won't be covered here.
Now upload NSTestStrict.php to the root folder of your site, and all the other distribution files to the /lightning/ folder. Run NSTestStrict.php to see it work. If it's working correctly, the data, map, trac and graph should show updates at the same rate that you are uploading new files. If something isn't updating correctly, double check your path to that item.
When transitioning into your own page that integrates into your site, don't forget to place these two lines in the <head> section
<link rel="stylesheet" type="text/css" href="./lightning/NSstyle.css" media="screen" title="screen" /><script type="text/javascript" src="./lightning/NSajax.js"></script>
and include NSdisplay.php in the <body> of your page like this
<?php
$path_to_NSfiles = "./lightning/"; // path to where all of the NSdisplay files are located.
include($path_to_NSfiles . "NSdisplay.php");
?>
If you install anything to somewhere other than the /lightning/ folder, pay particular attention to the paths to the various files because they must all be relative to the location of the script that includes NSdisplay.php.
If you want a legend like the one that is included (but matches your NexStorm setup), you'll have to cut it out of a downloaded image and size to approximately 245 x 45px. If you have trouble with this or want one with the transparent background, just email a NexStorm image with the legend on it to Jim and he'll be happy to put one together for you. His EMail address is on the "About" page of NSLog. Remember, this started out as a bandwidth saving project, and reducing the number of colors uploaded each cycle caused a significant reduction. If you aren't concerned with bandwidth, you can let NexStorm put in on the main image and set $path_to_legend = ""; in NSconfig-inc.php.
Strikes Graphs with JpGraph
If you don't have JpGraph yet, you can download it from their website for free. After it is uploaded to your server, configure either the strikes.php or strikes2.php file with the path to your JpGraph folder and upload. You can test the script in your browser (http://yoursite.com/lightning/strikes2.php) to see that it works..
wasp105.php
This is a PHP script to create a small version of your Wasp2 image if you have that available. It was initially put in place just to show how some sort of graphic could be added to the display. If you have the full sized Wasp2 image uploading to your /lightning/ folder you're all set, otherwise modify the script with the path to where it is actually located.
Happy Thunderstorm Watching!!
Technical Details for Code Junkies
There are some interesting things that developed in NSDisplay as it grew through it's nearly two years of development. PHP variables from the config file are passed to the javascript by writing them into the HTML so that there's a single point of configuration. The javascript does the normal screen updating, but also calls PHP scripts on the server to get information about file times, compute map coordinates based on strike distance and direction, and also to get the TRAC report data. The javascript also manipulates the DOM in order to plot the last strikes and to create the mouseover information for them. It's been an interesting and educational project.
This script-package is provided by Henkka Roblom (owner of this site) and Jim McMurry who wrote the NSLog-software, Juneau County Weather.
Gratuity
If you find this site or the free PHP scripts useful to you, please consider making a small donation to help offset my time and the routine expenses of operation of this website. Thanks for your kind support! - Henkka DonateVersion-history
Vers 2.0
Main release using data from the the NSLog-software
Vers 0.2
First release
Vers 0.3
Added support for TRAC report
Vers 1.0
Total rewrite of the package
Added support for multilanguage
Added support for Carterlake-template


