[OpenLayers-Dev] OpenLayer Map restrict panning and zooming

Phil Scadden p.scadden at gns.cri.nz
Sun Mar 24 13:50:57 PDT 2013


Firstly, please put requests like this on the users list. dev list is 
for discussions about changes to OL code.

Turning to your problem though. maxExtent should relate to the maximum 
range of the map coordinate system you use. You should not be using it 
to restrict zoom/pan and certainly should not be changing it in an 
event. Recipe for all kinds of problems. You should set restrictedExtent 
and maxExtent (if needed) in the map constructor. It should work. 
minScale, maxScale and resolutions properties provide addition control 
over zoom but shouldnt be needed.
eg
    * var map = new OpenLayers.Map({
      *     projection: "EPSG:3857",
      *     maxExtent: [-18924313.432222, -15538711.094146, 
18924313.432222, 15538711.094146],
      *     restrictedExtent: [-13358338.893333, -9608371.5085962, 
13358338.893333, 9608371.5085962],
      *     center: [-12356463.476333, 5621521.4854095]
      * });

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.



More information about the Dev mailing list