[OpenLayers-Dev] Google Base Layer and WMS Cover

Christopher Schmidt crschmidt at metacarta.com
Tue Jun 9 08:24:24 EDT 2009


On Tue, Jun 09, 2009 at 06:06:29AM -0400, Felipe Alcacibar wrote:
> 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?

"In order to properly overlay data on top of the maps provided by the
commerical API providers, it is neccesary to use this projection. This
applies primarily to displaying raster tiles over the commercial API
layers – such as TMS, WMS, or other similar tiles." --
http://docs.openlayers.org/library/spherical_mercator.html

> 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);
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list