There are too many question on this issue, but unfortunately I couldn't get the solution. I have the following settings,

var geographic = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
var mercator = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator Projection
var myExtent = new OpenLayers.Bounds(60, 23, 79, 37).transform(geographic, mercator);

map : {
        title : "Map",
        projection : mercator,
        displayProjection: geographic,
        extent: myExtent,
        restrictedExtent: myExtent,

The problem is that it zooms to the wrong location, secondly the pan is also not available.

1 Answer 1


Use this map, perhaps resolve your problem:

    map = new OpenLayers.Map({div:'map', allOverlays:true,
    projection: "EPSG:900913",
    maxExtent:new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
    displayProjection:new OpenLayers.Projection("EPSG:4326"),
    units: "m",
    numZoomLevels: 24,'sphericalMercator': true
// for panning and zooming:
pan=new OpenLayers.Control.PanZoom();



If the problem is not resolved, We must use another method.

  • Thanks for your response, previously var myExtent = new OpenLayers.Bounds(60, 23, 79, 37).transform(geographic, mercator); was returning bounds + center, when I used directly restrictedExtent : [6144368.4360405, 2724576.0254419, 9236093.3556889, 4446549.3984107], my problem was solved.
    – Mk Swati
    Commented Sep 29, 2015 at 13:09
  • @MkSwati Ok, please tik my answer!
    – Samane
    Commented Sep 30, 2015 at 11:37

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.