[OpenLayers-Users] Pan/Drag broken with Google Layer

Christopher Schmidt crschmidt at metacarta.com
Mon Oct 26 12:00:09 EDT 2009


On Tue, Oct 20, 2009 at 12:45:12PM +0200, Heiko Schröter wrote:
> Hello,
> 
> on Google Layers (api Ver 2) the Navigation Pan/Drag seems to be broken.
> It hapens with OL 2.7 and OL 2.8.
> 
> All other WMS Base Layers with different projections (epsg:4326, 900913,32665...) do work ok.
> Is there anything special in setting up the Google Layers with PAN/DRAG enabled ?
> Anything special about the Extents ?
> 
> Heiko
> 
> 
> <snip>
>     var myoptions = {
> 	eventListeners: {
> 	    "changebaselayer": mapBaseLayerChanged
> 	},
> 	projection: new OpenLayers.Projection("EPSG:900913"),
> 	displayProjection: new OpenLayers.Projection("EPSG:4326"),
> 	units: "dd",
> 	maxResolution: 'auto',
> 	maxExtent: new OpenLayers.Bounds(-180,-90,180,90),
        ^^ wrong, or at least needs to be overridden on the Google layer.

set it to the max extent of the globe in meters.

> 	controls: [
> 		   new OpenLayers.Control.PanZoom(),
> 		   new OpenLayers.Control.Navigation(),
> 		   new OpenLayers.Control.MousePosition({"numDigits": 2}),
> 		   new OpenLayers.Control.LayerSwitcher(),
> 		   new OpenLayers.Control.Attribution()
> 		   ],
> 	
> 	numZoomLevels: 5
>     };
>     map = new OpenLayers.Map('map', myoptions);
> 
>      var ggsat = new OpenLayers.Layer.Google(
>  					    "Google Satellite",
>  					    {type: G_SATELLITE_MAP,
>                                               numZoomLevels: 8,
>                                               maxResolution: 156543.0339,
>  					     'sphericalMercator': true});
>     
>      make_base_layers.push(ggsat);
> 
>     var epsg4326layer  = new OpenLayers.Layer.WMS( "EPSG:4326", 
>                                                http_mapserver,
>                                                {map: mapfile,
>                                                 layers: "KARTE,GRID,COPYRIGHT,LOGO",
> 						format: 'image/png',
>                                                 transparent: false },
>                                                {singleTile:true, isBaseLayer: true,
>                                                 wrapDateLine: true,
> 						attribution: 'ESRI',
> 						projection: new OpenLayers.Projection("EPSG:4326"),
> 						maxExtent: new OpenLayers.Bounds(xxxmin,yyymin,xxxmax,yyymax),
> 						restrictedExtent: new OpenLayers.Bounds(xxxmin,yyymin,xxxmax,yyymax),
> 						maxResolution: 'auto',
> 						numZoomLevels: 6,
>                                                 queryable: true});
>     
>     make_base_layers.push(epsg4326layer);
> 
> <snap>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list