jbox area
Arnold, Micheal B.
Micheal.Arnold at NSCORP.COM
Wed Dec 1 05:55:51 PST 2004
Thanks for the help Richard.
Here is the projection we are using:
PROJECTION
"proj=longlat"
"ellps=WGS84"
END
Would the constant used to determine the area change based on different UTM
zones?
Thanks again.
Mike Arnold
micheal.arnold at nscorp.com
-----Original Message-----
From: Richard Greenwood [mailto:richard.greenwood at gmail.com]
Sent: Tuesday, November 30, 2004 9:28 AM
To: Arnold, Micheal B.
Cc: mapserver-users at lists.umn.edu
Subject: Re: [UMN_MAPSERVER-USERS] jbox area
jBox returns an area in screen pixels. You must convert it to sq feet,
sq meters, sq miles, or whatever you like. I wrote the above functions
to convert to sq feet and/or acres for a state plane coordinate system
in US Survey Feet. You need to modify them for your coordinate system,
resloution setting (if not 72), and desired output units.
Regards,
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com
On Mon, 29 Nov 2004 10:42:49 -0500, Arnold, Micheal B.
<micheal.arnold at nscorp.com> wrote:
>
>
>
> 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");
>
> }
More information about the MapServer-users
mailing list