distance measure

Steve Lime Steve.Lime at DNR.STATE.MN.US
Fri May 4 11:31:42 EDT 2007


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



More information about the mapserver-users mailing list