[OpenLayers-Users] Get Coordinates after moving mouse

Casper Børgesen cbo at le34.dk
Mon Dec 7 05:56:30 EST 2009


I have previously used the following:

map.events.register("mousemove", map, function(e) {
    var position = this.events.getMousePosition(e);
    var lonlat = map.getLonLatFromPixel(position);
    // A mysterious error is causing OpenLayers to return a non-varying fraction after a zoom has been made.
    // This is removed by toFixed().
    OpenLayers.Util.getElement("Easting").innerHTML = lonlat.lon.toFixed(0) + "<i>m</i>";
    OpenLayers.Util.getElement("Northing").innerHTML = lonlat.lat.toFixed(0) + "<i>m</i>";
});

Regards, Casper

-----Oprindelig meddelelse-----
Fra: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] På vegne af stash
Sendt: 7. december 2009 11:51
Til: users at openlayers.org
Emne: [OpenLayers-Users] Get Coordinates after moving mouse


Hello,

I have a question, which is not so difficult but I can't solve it. 

I have mousemove event like this:

 map.events.register('mousemove', map, callthis);


now i want to get in my callthis function the coordinates of the position of my mouse (the coordinates which are displayed in the lower right corner of the openlayers map).

How do I get them.

can someone help me?

regards
stash
--
View this message in context: http://n2.nabble.com/Get-Coordinates-after-moving-mouse-tp4125336p4125336.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



More information about the Users mailing list