JBOX - distance measuring

Richard Greenwood richard.greenwood at GMAIL.COM
Wed Dec 28 06:49:56 PST 2005


salah jubeh <s_jubeh <at> YAHOO.COM> writes:

> 
> 
> Hi Guys     I want to know how this function works - what are these parameters
s, t, and specially c.     also is there is any way to do this without applets.
since the client has to download java VM and many times compatibility problems
occurs.     Thanks in advance.     function measure_handler(name, s, t, n, a)
{// c = 1 / 72dpi / 12inches_per_foot * 1.0003state_plane_scale_factorvar c =
0.0011577546296296; // constantvar f = [scale] * c; // scale factorif ((s>0) ||
(t>0)) {defaultStatus = "This segment = " + s*f + ", Total = " + t*f + ", Number
of vertices = " + n ;}}


jBox returns values in screen pixels. 
    function measure_handler(name, s, t, n, a)
s is the length of the current segment (in pixels)
t is the total length of all segments
n is the total number of verices (pionts clicked)
a is the area in screen pixels

You must convert the pixel values to real world values with javascript code.
Basically pixel_value * conversion_factor = real_world_distance. The
conversin_factor is the size of the screen pixel in real world units. The 'c' in
the example is a constant used in that caluclation.

HTH,
Richard Greenwood



More information about the MapServer-users mailing list