[Mapserver-users] Re: measure distance

pkishor_98 pkishor at geoanalytics.com
Sun Aug 3 07:21:30 PDT 2003


--- In mapserver-users at yahoogroups.com, "Roman Meier" <mapserver at g...> wrote:
> Hi list
> 
> I use mapserver as a cgi with dhtml and javascript just as the
> landview-site.
> Now, I would like to give to the user the possibility to measure distances.
> Could somebody share his code with me? Or give me some help to realize it?


here's some guidance to realize it.

The problem is not with measuring the distance --

- get the mouse-clicks, 
- convert them to geog. space, 
- calc the distance
- show the distance in some widget like an input box.

The problem is with giving the user feedback on mouse-clicks. Javascript has no 
mechanism for "drawing" on the browser canvas. The ever-popular zoombox 
rubberband is a kludge really, albeit an effective one, achieved by clipping layers. 
Unfortunately, that can only be done for lines parallel to the axes. For diagonal lines 
there is no good answer.

DMSolutions has a reasonable solution by using those rubbery bouncing balls that 
trail your mouse cursor.

A Java applet would work, however, that is only compatible with a limited number of 
browser/OS combos.

A colleague of mine has implemented a very nice solution using VML, unfortunately 
which works only in IE on Win.

The way to go would be, perhaps, to implement an interface in SVG, it being a 
standard and all. But that too would require the SVG plug-in.

The basic problem is that as soon as we can do something well in the browser, we 
want to do something that we can't really do well. The browser is an efficient 
instrument because it was designed to do little, and do it well across platforms. Along 
came the spider in the form of a big West-coast company and decided to make a 
browser that did other things as long as you drank their cola...





More information about the MapServer-users mailing list