Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

Thanks in advance

share|improve this question
add comment

2 Answers 2

up vote 9 down vote accepted

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...

share|improve this answer
    
Brilliant! Thanks for your help. –  CatchingMonkey Jun 1 '12 at 10:10
    
you're welcome. –  Aragon Jun 1 '12 at 10:22
    
Very odd that Map has a movestart event, but Layer doesn't... –  ach Sep 19 '13 at 20:18
add comment

If the automatic Geolocation is enabled, the event is called either the map moved automatically or the user moved it. So, this is a problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.