I used

Distance = (x2 – x1)/ mapWidh * t

where (x2 – x1)/ mapWidh should be resolution in [m]/[pixel] (x2 and x1 are
taken from "imgext" hidden value, as setted by jbox/dbox.

My raster has 1m resolution, so I can't test with precision.
I tested both ways with an open 50m swimming pool  (as  I hadn't  other
references...) and  both gave me closer results (but I  didn't test the
[scale] formula with other monitor resolutions). At the end, I used the
formula above.

Thanks
Piero


2007/5/4, Steve Lime <[EMAIL PROTECTED]>:

I wouldn't use scale since that's an artificial number and should only
be used for relative comparisons (like turning layers on/off). Instead
you'd want to use cellsize (pixel width or height). How you get that
value depends on your application. Are you using mapserv.js? If so it's
probably there for you. There may be a template substitution as well.

Steve

>>> On 5/4/2007 at 10:06 AM, in message
<[EMAIL PROTECTED]>, Piero
Cavalieri
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I use jBox to calcolate distance measure.
> In jBox documentation I found this function:
>
> 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)) {
> defaultStatus = "This segment = " + s*f + ", Total = " + t*f + ",
> Number of vertices = " + n ;
> }
>
> Since I'm not able to have user dpi (and 72 is a mean value, I
suppose),
> isn't more correct (and simpler) to use this way: ?
>
> Distance = (x2 – x1)/ mapWidh * t
>
>  Where x2 and x1 are mapextents in real world coordinates, as
returned in
> imgext, mapWidth is the width in pixel, as specified in .map file
(and
> returned in template file), and t is the jBox meaure, in pixel.
>
> Thanks
>
>  Piero

Reply via email to