0

I'm quite new to OpenLayers and much of the documentation is just strings of jargon, so please forgive me if this is a noobish question.

I've intialised an OpenLayers map with Google physical and satellite layers plus a vector layer for users to add polygons. The init code is as follows:

//define extent
var miny=-2000000; var minx=6000000; var maxy=600000; var maxx=10003750;

        // allow testing of specific renderers via "?renderer=Canvas", etc
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;



//define the layers needed
    g_phys  =   new OpenLayers.Layer.Google("Google Physical",{type: google.maps.MapTypeId.TERRAIN, numZoomLevels:20}, {isBaseLayer:true});
    g_sat   =   new OpenLayers.Layer.Google("Google Satellite",{type: google.maps.MapTypeId.SATELLITE, numZoomLevels:20},{isBaseLayer:true});
    boxes  =    new OpenLayers.Layer.Vector("Boxes", {rederers:renderer});


//create new set of option for the map
var options = {
            projection: new OpenLayers.Projection("EPSG:3857"),
            units: "m",
            maxResolution: "auto",
            maxExtent:  new OpenLayers.Bounds(miny, minx, maxy, maxx),
            theme: null,
            layers: [
                //define the base layers for the map
                g_phys,
                g_sat,
                boxes

                    ]

        };


//create new map object based on "map" div
map=new OpenLayers.Map('map',options);
map.zoomToMaxExtent();

However, the map allows a maximum zoom such that the window shows about the length of Canada and one of my clients would like to easily add polygons that span larger than this distance, so needs to zoom out further.

I've tried changing the maxextent values and this doesn't seem to help. Could anyone help explain to someone not overly familiar with Geography how to allow the user to zoom out further - ideally to view from the Arctic to Antarctica at maximum zoom.

marked as duplicate by BradHards, Paul, Fezter, Curlew, PolyGeo Nov 23 '13 at 20:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Why are you using the maxExtent, remove it and you can zoom to whole world. – neogeomat Nov 22 '13 at 11:59
  • @netgeomat - removing maxExtent literally just moves the map centre to 0,0 (off the coast of Africa) and does nothing to the zoom levels. – Ambulare Nov 22 '13 at 12:12
  • Also try removing the maxResolution – neogeomat Nov 22 '13 at 12:23
  • I put your code here: jsfiddle.net/8mq7H and I'm not able to reproduce the problem. You may have a a CSS, HTML or JavaScript error. Please feel free to edit the JSFiddle to provide an example where you can reproduce the issue. – Julien-Samuel Lacroix Nov 22 '13 at 15:22
  • @Julien-SamuelLacroix Thanks Julien, you have reproduced the problem exactly! If possible, I would like to zoom out so that I can see, for example, the entirety of North and South America in one window, even if this results in the map wrapping horizontally. – Ambulare Nov 22 '13 at 15:30

Browse other questions tagged or ask your own question.