[Mapserver-users] mouse coordinates displayed

Steve Lime steve.lime at dnr.state.mn.us
Fri Jan 9 08:49:46 PST 2004


Hi Steve: It's pretty straight forward. There are 2 steps:

1) Add (or uncomment) the the line: main.verbose = true; right after
the main dBox object is created.

2) edit the function mousemove_handler, something like this:

  function mousemove_handler(name, x, y) {
    var status = '';
    var utm = new Point(Number(ms.extent[0] + x*ms.cellsize),
Number(ms.extent[3] - y*ms.cellsize));
    // var latlon = UTMToGeographic(15, utm);

    status = "UTM Coordinates: x=" + Math.round(utm.x) + " and y=" +
Math.round(utm.y);
    // status = status + ", latitude =" + latlon.y + " and longitude="
+ latlon.x;

    window.status = status;
  }

That's it. If you didn't change the javascript in the demo you should
only have to uncomment one line. Let me know if you have questions.

Steve

>>> Steve McCrone <ms57 at streamyx.com> 1/8/2004 6:46:27 PM >>>
I am working with the "DHTML rubber band box" sample, found at  - 
  http://maps.dnr.state.mn.us/mapserver_demos/workshop 

 I wish to have the mouse coordiantes (in the projection of the shape
file) displayed when the user moves the mouse around.


Thanks



More information about the MapServer-users mailing list