[Mapserver-users] Re: jBox

Richard Greenwood rich at greenwoodmap.com
Thu Feb 26 14:01:06 PST 2004


Michael Smith wrote:

> Rich,
> 
> You have helped me tremendously in the past so I thought I would ask you a
> question.  I have jBox working but am unclear on how to get the measure tool
> working.  I put this code:
> 
> 	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 ;
> 		}
> 	}
> 
> in the head of my html.  Do you have an example of what I do next.  I am not
> very familiar with js, so any help is appreciated.  I do have a measure icon
> on my html page, so how could I make a click of this button work the measure
> tool.  Thank you in advance.
> 
> Michael Smith, Planner II
> City of San Angelo
> Planning & Development
> 325.657.4210 Fax: 325.481.2648
> Email: msmith at sanangelompo.org 

Just call document.jBox.lineon(); when the user selects the measure 
button. This will put jBox into "measuring" mode. As the user moves the 
mouse, jBox will call the measure_handler() function, which converts the 
screen pixel coordinates to feet, and displays the result in the 
browser's status bar. Note that c is for my state plane coordinate zone 
and elevation, and will need to be calculated for your needs.

(I am cc'ing the list so that this finds it's way to the archive)

-- 
Richard Greenwood
www.greenwoodmap.com



More information about the MapServer-users mailing list