Example 9: The Data Probe
This examples uses the data probe and also includes the
"distance" control.
To use the "distance" control, you must define
the "map_scale" parameter in your configuration file.
With the "distance" control activated, the user "drags" the pointer
(holding mouse button while moving, or drag your finger on touch
devices) from a starting location to the destination. A line
appears, with a distance value readout.
To use the "data probe", you must define
a set of transformations from RGB (Red, Green, Blue) pixel color
values to "physical" values, and put these in a text file as
illustrated below the images.
In the following example, there are 3 different images you can
probe.
For the Radar Reflectivity, be sure to move the pointer to the
upper left corner and note the difference in the displayed text.
While most of the "black" area is completely transparent, the
upper left is opaque, so different text can be shown (see below).
You might notice a green-shaded "hoverzone" somewhere in the
image as well -- it is defined in the file_of_filenames. Here is the configuration file:
We have also changed the refresh button into an icon...
auto_refresh = 1
file_of_filenames = fof9.txt
controls = location,distance,probe,zoom,refresh
controls_style = padding:5px;background-color:green;
buttons_style=padding:5px;background:linear-gradient(white,blue);vertical-align:middle;margin-left:10px;font-family:arial;font-size:14px;padding:5px;border-radius:10px;
refresh_style=border:0px;height:32px;width:32px;background:URL("reload.png");
refresh_label=.
bottom_controls=overlay
overlay_labels=GOES LI/on, GOES TPW, Radar Reflectivity
overlay_radio=true/1,true/1, true/1
overlay_transparent_amount = 100, 100, 100
overlay_probe_table = 2, 3, 1
probe_table = tabs.txt
tipbox_display_style = #eee, #000, 12px arial, #800, 10, 5, 5
popup_style=background:linear-gradient(#aaf,#f90);
probe_display_style = #00f, #fff, 14px times, #440, 10, 4,4
distance_display_style = #ff000060, yellow, 18px arial bold, 2, pink, #330,10,10,10
distance_unit = mi
coordinates = 43.9, -102.9, 27.5, -73.4
#coordinates are very approximated!
show_bearing = to
overlay_labels_style=font-family:arial;color:white;font-size:20px;padding:2px;background-color:green;
overlay_tooltip = GOES Lifted Index, GOES Total Precipitable Water, Sample Radar Reflectivity
zoom_style=width:120px;
The data probe table file consists of one or more tables that map
physical data values to RGB (Red, Green, Blue) pixel values.
The assumption is that between given RGB values, one can
use a linear interpolation to deduce values in between.
Each table begins with a line like this:
*Name of table [, optional display text for transparent pixels]
The asterisk and the Name of table are required.
The optional... text will only appear if the pixel is
completely transparent (that is, the alpha value == 0).
Following this header, one or more lines specifying the
"breakpoints" are given. As with FlAniS, you may include
extra information regarding the number of decimal digits to
display, the units (will be appended to the numeric value)
and a "prefix" (will precede the value). For example:
0.37 18 160 246 , 2 , inches per hour , Rainfall Rate=
indicates that the "data" value of "0.37" is at Red=18,
Green=160, and Blue=246. In addition, 2 decimal digits
are to be used, and the display value should appear like:
Rainfall Rate= 0.37 inches per hour
The appended information will apply to all subsequent lines
until new values are given (see the GOES tables, below for an
example of changing units within the table).
You may also specify a Text String to be displayed for a
specific RGB value. For example:
0.0 100 200 0, "Snow"
will display "Snow" (without the quotes) for an RGB value of
(100,200,0).
Here is the complete data probe table used in this example:
*Rainfall Rates, Nothing...
0.00 0 0 0, "No rain...or snow!"
0.009 1 160 246 , 2 , inches per hour , Rainfall Rate=
0.01 0 0 246
0.02 0 255 0
0.05 0 200 0
0.07 0 144 0
0.10 255 255 0
0.22 231 192 0
0.45 255 144 0
0.92 255 0 0
1.90 214 0 0
4.0 255 0 255
8.8 200 0 200
16.6 150 0 150
999 255 0 0,"Too much precip!"
OMG 255 255 255
*GOES-LI , These's aren't the droids you're looking for...move along...
25. 0 0 0, "Fade to black"
24.8 2 2 2,"Fade to black"
24.6 60 40 10,1,C, LI=
0.28 215 165 115
0.08 128 128 255
-3.74 63 63 106
-3.94 100 100 0
-7.76 233 233 0
-7.97 255 0 0
-11.78 120 0 0
-12.0 100 0 0
-14.2 85 0 0
-14.4 80 0 0
-15.0 60 0 0
-15.0 109 0 0
301 110 110 110, 2, K,CTT=
273.6 128 128 128
271.55 148 148 148
242.09 170 170 170
240.13 190 190 190
222.45 220 220 220
220.49 230 230 230
193.0 255 255 255
*GOES-TPW, ...move along....
0 0 0 0, 1,mm,TPW=
.336 1 0 0
.673 60 40 10
9.764 217 167 117
10.1 150 150 250
19.86 80 80 150
20.0 0 100 100
29.965 115 165 40
30.3 145 190 60
40.065 255 255 0
40.0 255 130 100
50.165 150 40 40
50.50 100 0 100
60.267 240 0 240
60.603 255 200 255
67.0 225 180 225
301 110 110 110,1,K,CTT=
273.6 128 128 128
271.55 148 148 148
242.09 170 170 170
240.13 190 190 190
222.45 220 220 220
220.49 240 240 240
193.0 256 256 256