Hi, folks: I just posted this to the maptools bugzilla in response to an open javascript distance measuring tool that may hopefully end up in ka-map.
If you look at the bottom post on http://bugzilla.maptools.org/show_bug.cgi?id=1145, there is a demo page that demonstrates a simple JS distance measuring application. I can't take credit for the JS -- I just found it. It works fine for me. Charlton > -----Original Message----- > From: UMN MapServer Users List [mailto:[EMAIL PROTECTED] On > Behalf Of Richard Greenwood > Sent: Wednesday, December 28, 2005 9:50 AM > To: [email protected] > Subject: Re: [UMN_MAPSERVER-USERS] JBOX - distance measuring > > salah jubeh <s_jubeh <at> YAHOO.COM> writes: > > > > > > > Hi Guys I want to know how this function works - what are these > parameters > s, t, and specially c. also is there is any way to do this without > applets. > since the client has to download java VM and many times compatibility > problems > occurs. Thanks in advance. function measure_handler(name, s, t, n, > a) > {// c = 1 / 72dpi / 12inches_per_foot * 1.0003state_plane_scale_factorvar > c = > 0.0011577546296296; // constantvar f = [scale] * c; // scale factorif > ((s>0) || > (t>0)) {defaultStatus = "This segment = " + s*f + ", Total = " + t*f + ", > Number > of vertices = " + n ;}} > > > jBox returns values in screen pixels. > function measure_handler(name, s, t, n, a) > s is the length of the current segment (in pixels) > t is the total length of all segments > n is the total number of verices (pionts clicked) > a is the area in screen pixels > > You must convert the pixel values to real world values with javascript > code. > Basically pixel_value * conversion_factor = real_world_distance. The > conversin_factor is the size of the screen pixel in real world units. The > 'c' in > the example is a constant used in that caluclation. > > HTH, > Richard Greenwood
