[OpenLayers-Dev] Google Base Layer and WMS Cover

Felipe Alcacibar falcacibar at gmail.com
Tue Jun 9 06:06:29 EDT 2009


Hi, i have a Google Base Layer and a WMS cover, y convert my
cartography (WMS cover) to epsg:4326 WCS WGS84 the problem come when i
panTo or zoom, when openlayers draw the map the WMS layer its above
that the place that must be shown, when i deactivate and activate the
layer using the layer switcher, redrawi in the correct place i have
something wrong or it is a bug?

I'm using openlayers 2.7

cheers, take care.

Felipe


/// the JavaScript Source


extent					= "-74.65234 -51.01375  -70.45508 -30.37288".split(/[,
]+/);
			for (i=0;i<extent.length;i++) extent[i] = parseFloat(extent[i]);
			
			var mapdim				= getElementDimensions($('map'));
			myBounds				= new OpenLayers.Bounds(
																extent[0], extent[1],
																extent[2], extent[3]
									  );
			var zoomAttributes = {						
										numZoomLevels		: 19,
										minZoomLevel		: 5,
										transitionEffect	: 'resize'
			}

			
			
            map = new OpenLayers.Map( 'map', {
				numZoomLevels		: 19,
				minZoomLevel		: 5,            	            	
				maxExtent			: myBounds,				
				restrictedExtent	: myBounds,				
				projection			: new OpenLayers.Projection('epsg:4326'),								
				tileSize			: new OpenLayers.Size(600, 600),													
				buffer				: 3,				
				controls			: [
										new OpenLayers.Control.Navigation(),
										new OpenLayers.Control.PanZoomBar(),
										new OpenLayers.Control.MousePosition({div : $('map-coords'),
title : 'Coordenadas de la posicion del puntero.'}),
										new OpenLayers.Control.NavToolbar(),
										new OpenLayers.Control.ZoomBox(),
										new OpenLayers.Control.Scale($('map-scale')),
										new OpenLayers.Control.ScaleLine()
										
				]													
            });

	    	map.addControl(new OpenLayers.Control.LayerSwitcher());
			
            var ghyb = new OpenLayers.Layer.Google(
                "Google Hybrid",
                OpenLayers.Util.extend(zoomAttributes, {type: G_HYBRID_MAP})
            );			
            var gphy = new OpenLayers.Layer.Google(
                "Google Physical",
                OpenLayers.Util.extend(zoomAttributes, {type: G_PHYSICAL_MAP})
            );
            var gmap = new OpenLayers.Layer.Google(
                "Google Streets", // the default
                OpenLayers.Util.extend(zoomAttributes, {type : null})
            );
            var gsat = new OpenLayers.Layer.Google(
                "Google Satellite",
                OpenLayers.Util.extend(zoomAttributes, {type: G_SATELLITE_MAP})
            );

		    wmsl = new OpenLayers.Layer.WMS( 'Mapa WMS',
					httpBase + "/wms/", {
							layers 				: 'rodales',
							format 				: "image/png; mode=24bit",	
							alpha				: true,
							projection			: new OpenLayers.Projection('epsg:4326')
							
					},{	
							isBaseLayer : false,
					}
		    );
			
            map.addLayers([ghyb, gphy, gmap, gsat]);
	   	 	map.addLayer(wmsl);
			
            map.setCenter(myBounds.getCenterLonLat(), 0);



More information about the Dev mailing list