I used <br><br>Distance = (x2 – x1)/ mapWidh * t<br><br>where (x2 – x1)/ mapWidh should be resolution in [m]/[pixel] (x2 and x1 are taken from &quot;imgext&quot; hidden value, as setted by jbox/dbox.<br><br>My raster has 1m resolution, so I can&#39;t test with precision.
<br>I tested both ways with an open 50m swimming pool&nbsp; (as&nbsp; I hadn&#39;t&nbsp; other references...) and&nbsp; both gave me closer results (but I&nbsp; didn&#39;t test the&nbsp; [scale] formula with other monitor resolutions). At the end, I used the formula above.
<br><br>Thanks<br>&nbsp;Piero <br><br><br><div><span class="gmail_quote">2007/5/4, Steve Lime &lt;<a href="mailto:Steve.Lime@dnr.state.mn.us">Steve.Lime@dnr.state.mn.us</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I wouldn&#39;t use scale since that&#39;s an artificial number and should only<br>be used for relative comparisons (like turning layers on/off). Instead<br>you&#39;d want to use cellsize (pixel width or height). How you get that
<br>value depends on your application. Are you using mapserv.js? If so it&#39;s<br>probably there for you. There may be a template substitution as well.<br><br>Steve<br><br>&gt;&gt;&gt; On 5/4/2007 at 10:06 AM, in message
<br>&lt;<a href="mailto:fd606ea20705040806m3e2215dbx4e73c7662d41b863@mail.gmail.com">fd606ea20705040806m3e2215dbx4e73c7662d41b863@mail.gmail.com</a>&gt;, Piero<br>Cavalieri<br>&lt;<a href="mailto:piero.cavalieri@GMAIL.COM">
piero.cavalieri@GMAIL.COM</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; I use jBox to calcolate distance measure.<br>&gt; In jBox documentation I found this function:<br>&gt;<br>&gt; function measure_handler(name, s, t, n, a) {
<br>&gt; // c = 1 / 72dpi / 12inches_per_foot *<br>1.0003state_plane_scale_factor<br>&gt; var c = 0.0011577546296296;&nbsp;&nbsp;&nbsp;&nbsp;// constant<br>&gt; var f = [scale] * c;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // scale factor<br>&gt; if ((s&gt;0) || (t&gt;0)) {
<br>&gt; defaultStatus = &quot;This segment = &quot; + s*f + &quot;, Total = &quot; + t*f + &quot;,<br>&gt; Number of vertices = &quot; + n ;<br>&gt; }<br>&gt;<br>&gt; Since I&#39;m not able to have user dpi (and 72 is a mean value, I
<br>suppose),<br>&gt; isn&#39;t more correct (and simpler) to use this way: ?<br>&gt;<br>&gt; Distance = (x2 – x1)/ mapWidh * t<br>&gt;<br>&gt;&nbsp;&nbsp;Where x2 and x1 are mapextents in real world coordinates, as<br>returned in<br>
&gt; imgext, mapWidth is the width in pixel, as specified in .map file<br>(and<br>&gt; returned in template file), and t is the jBox meaure, in pixel.<br>&gt;<br>&gt; Thanks<br>&gt;<br>&gt;&nbsp;&nbsp;Piero<br></blockquote></div><br>