[OpenLayers-Users] overlay over Google layers, spherical mercator projection

Christopher Schmidt crschmidt at metacarta.com
Fri Dec 21 12:36:14 EST 2007


On Fri, Dec 21, 2007 at 06:17:12PM +0200, Maria Panagou wrote:
> Hi,
> I'm trying to built an openlayers app, displaying a Google maps base layer
> and a WMS layer. My Wms layer, based on Mapserver, was originally in WGS84
> projection and didn't display correctly overlaid on the Google map (a slight
> y-axis shift). I decided to follow the spherical Mercator example, so I
> formed my html like this:

drop the maxResoluion from your Map object. It can't affect Google
(since it has a fixed set of resolutions) and all it's doing is causing
your overlay to not turn on.

-- Chris

>  var centerM=OpenLayers.Layer.SphericalMercator.forwardMercator(24, 38.3);
>         var zoom = 7;
>         var map, layer;
> 		
> 		var blow = OpenLayers.Layer.SphericalMercator.forwardMercator(20, 34.8);
> 		var bhigh = OpenLayers.Layer.SphericalMercator.forwardMercator(28.4,
> 41.6);
> 
>         function init(){
> 		 	var options = {
> 				numZoomLevels: 16,
> 				projection: "EPSG:900913",
> 				units: "m",
> 				maxResolution: 3000,
> 				maxExtent: new OpenLayers.Bounds(blow.lon, blow.lat, bhigh.lon,
> bhigh.lat),
> 				restrictedExtent: new OpenLayers.Bounds(blow.lon, blow.lat, bhigh.lon,
> bhigh.lat),
> 				controls: [new OpenLayers.Control.LayerSwitcher(),
> 				 new OpenLayers.Control.PanZoomBar(),
> 				new OpenLayers.Control.MouseToolbar(),
> 				new OpenLayers.Control.MousePosition({prefix: 'x: ', separator: ', y:
> '})],
> 				
> 				 theme:null
>             }
>             map = new OpenLayers.Map('map', options);
>             
>             var satellite = new OpenLayers.Layer.Google( "Google Satellite"
> , {type: G_SATELLITE_MAP, 'sphericalMercator':true} );
>             var hybrid = new OpenLayers.Layer.Google( "Google Hybrid" ,
> {type: G_HYBRID_MAP, 'sphericalMercator':true });
> 	    var dtm = new OpenLayers.Layer.WMS( "ICEDS (Integrated CEOS European
> Data Server) WMS",
>                 "http://iceds.ge.ucl.ac.uk/cgi-bin/icedswms?", {layers:
> "srtm"});
> 	    var quakes = new OpenLayers.Layer.WMS.Untiled( "???????????????????? ??????????????",
>                
> "http://127.0.0.1:80/cgi-bin/mapserv.exe?map=../htdocs/mpanagou/Quakes1.map&",
> {layers: "Quakes",
>                  transparent: "true", format: "image/png", isBaseLayer:
> "false", srs:"EPSG:900913"});
> 				
> 		    map.addLayers([satellite, hybrid, dtm, quakes]);
>     
>  			map.setCenter(new OpenLayers.LonLat(centerM.lon, centerM.lat), zoom);
>             
>         }
> 
> I had to also convert my WMS layer to Spherical Mercator coords. The problem
> now is that now the overlay layer appears to be grayed out and it doesn't
> display at all. I thought it maybe had something to do with resolutions and
> set maxresolution to the wms but didn't work. When i set the parameter for
> the getmap request  "displayOutsideMaxExtent: true" then the overlay is
> activated, can be switched on and off but I stil can't see it. I verified
> that coords are ok. Please help me, I'm stuck
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list