[GIS] On Map Move event in OpenLayers

eventsopenlayers

In my OpenLayers web app I have registered an onmousemove event which performs certain functions. What I am really after though is a way to register and handle the user panning or zooming the map.

Best Answer

In OpenLayers 2 you can do with the same method:

map.events.register(type, obj, listener);

movestart triggered after the start of a drag, pan, or zoom

move triggered after each drag, pan, or zoom

moveend triggered after a drag, pan, or zoom completes

zoomend triggered after a zoom completes

example code:

 map.events.register("move", map, function() {
            console.log("panning");
        });

i hope it helps you...