[OpenLayers-Users] zooming to fit the full earth using google maps layers

Jeff Storey jeff.storey at nextcentury.com
Thu Dec 6 16:53:06 PST 2012


I have a map that uses the google earth hybrid layer as the base layer. I would like it so the map is initially zoomed to show the whole world, but I can't quite figure out how.

My code looks like
var map = new OpenLayers.Map({
 div: "map",
 projection: 'EPSG:3857',
 layers: [
    new OpenLayers.Layer.Google("Google Hybrid",{type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20})
  ],
  center: new OpenLayers.LonLat(0,0).transform('EPSG:4326', 'EPSG:3857')
}); 

map.zoomToMapExtent();

Do I need to set the map div dimensions to a particular aspect ratio (or a minimum height/width)?

Also, is there a way to prevent the user from panning when zoomed out all the way?

Thanks,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121206/04b1d121/attachment.html>


More information about the Users mailing list