Firstly i found a logic to customize or extends Openlayers 2 Control Navigation. I dont want to custom the openlayers default, because I'm currently using 2 different map in one page. especially to custom after panning or zooming.

The purpose is I Whenever user after panning/zooming/wheel-zoom or the position/zoom of first map is change, it can get latests 4 LatLon of corner side from frame viewed first map then call a function to process it.

edit: already found a way using event register

  • Can you clarify your second paragraph?
    – camdenl
    Nov 27, 2014 at 14:11
  • the second is after user panning the first map, it can give alert about LatLon of frame first map. frame first map means, the visible map on user view. Nov 28, 2014 at 2:32

1 Answer 1


Okey, maybe I found a better way using map.event.register

map.events.register("zoomend", map, function(e){    
    // after zoom

map.events.register('moveend', map, function (e) {
    // after pan

then to find corner latlon after it, I can use Map function

map.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0)); // corner bot-lef
map.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,map.size.h)); // corner bot-right
map.getLonLatFromViewPortPx(new OpenLayers.Pixel(map.size.w, map.size.h)); // corner top-right
map.getLonLatFromViewPortPx(new OpenLayers.Pixel(map.size.w,0)); // corner top-left

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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