distance measure

Piero Cavalieri piero.cavalieri at GMAIL.COM
Fri May 4 12:03:45 EDT 2007


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 <Steve.Lime at dnr.state.mn.us>:
>
> 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
> <fd606ea20705040806m3e2215dbx4e73c7662d41b863 at mail.gmail.com>, Piero
> Cavalieri
> <piero.cavalieri at GMAIL.COM> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070504/e5ea05d7/attachment.html


More information about the mapserver-users mailing list