jbox area

Arnold, Micheal B. Micheal.Arnold at NSCORP.COM
Mon Nov 29 10:42:49 EST 2004


For some reason, the area that I am getting back for polygons using jbox
seems to be off.  The segment length and total length seem to be fine, but
the area is off by a factor of about 5.  Does anybody have any ideas or
suggestions?  Below are the measure_handler functions I am using.



Thanks for the help!



Mike Arnold

micheal.arnold at nscorp.com



function measure_handler(name, s, t, n, a)

{

                // c = 1 / 72dpi / 12inches_per_foot *
1.0003state_plane_scale_factor

                var c = 0.0011577546296296;                // constant

                var f = [scale] * c;                   // scale factor

                if ((s>0) || (t>0))

                {

                                if (n < 3)

                                {

                                                defaultStatus = "This
segment = " + distFormat(s*f) + ", Total = " + distFormat(t*f) + ", Number
of vertices = " + n ;

                                }

                                else

                                {

                                                defaultStatus = "This
segment = " + distFormat(s*f) + ", Total = " + distFormat(t*f) + ", Number
of vertices = " + n + ", Area = " + distFormat(a*f) ;

                                }

                }

}



function roundFeet(x)

{

                var fpp = ([maxx] - [minx]) / [mapwidth]; // resolution
(feet per pixel)

                if (fpp < 4)  return (Math.round(x));

if (fpp < 8)  return (Math.round(x/5)*5);

if (fpp < 17) return (Math.round(x/10)*10);

if (fpp < 40) return (Math.round(x/25)*25);

if (fpp < 80) return (Math.round(x/50)*50);

return (Math.round(x/100)*100);

}



function distFormat(x)

{

var d;

if (x > 7920) return ((Math.round(x/5280*10)/10) + " miles");

d = roundFeet(x);

if (d > 2640)

return (d + " ft (" + (Math.round(x/5280*10)/10) + ")mile");

return (d + " ft");

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20041129/b00009c2/attachment.html


More information about the mapserver-users mailing list