This is the default behavior of OpenLayers when using Google layers. The parameter that controls this is wrapDateLine: false
. Simply modify your code with this to be able to zoomout further:
var google_default = new OpenLayers.Layer.Google("Google Default", {wrapDateLine: false})
var google_satellite = new OpenLayers.Layer.Google("Google Satellite", {type: google.maps.MapTypeId.SATELLITE, wrapDateLine: false})
When using WFS layers it is a good idea to not use wrapDateLine: false
anyway. Otherwise you could end up with your vectors on the wrong side of the DateLine and outside of the visible map.
Update:
You are using a GoogleMaps Layer. This layer already set the maxExtent to the default value -20037508.34,-20037508.34,20037508.34,20037508.34
. You don't have to play with that.
In some cases, OpenLayers adjust the minimum (zoomed-out) level to make it fit in your map size. If you are using the wrapDateLine: true
(which is the default value with Google layers) in your baseLayer, the zoom level is adjusted to shows a map not wider than its maxExtent.
Now, to answer your original question, to be able to zoom out further, you can:
This is the revelant OpenLayers code that prevent you from zooming out further when wrapDateLine is set to true in your layer. This is always called when you zoom in/out with OpenLayers >= 2.13:
/**
* Method: adjustZoom
*
* Parameters:
* zoom - {Number} The zoom level to adjust
*
* Returns:
* {Integer} Adjusted zoom level that shows a map not wider than its
* <baseLayer>'s maxExtent.
*/
adjustZoom: function(zoom) {
if (this.baseLayer && this.baseLayer.wrapDateLine) {
var resolution, resolutions = this.baseLayer.resolutions,
maxResolution = this.getMaxExtent().getWidth() / this.size.w;
if (this.getResolutionForZoom(zoom) > maxResolution) {
if (this.fractionalZoom) {
zoom = this.getZoomForResolution(maxResolution);
} else {
for (var i=zoom|0, ii=resolutions.length; i<ii; ++i) {
if (resolutions[i] <= maxResolution) {
zoom = i;
break;
}
}
}
}
}
return zoom;
},
Best Answer
This was answered on the main site few years ago.
https://stackoverflow.com/questions/4122160/mouse-drag-on-kml-features-with-openlayers
And in some respects in the OL documentation as well:
http://trac.osgeo.org/openlayers/wiki/SelectFeatureControlMapDragIssues