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

Maria Panagou snowdrop at ath.forthnet.gr
Fri Dec 21 11:17:12 EST 2007


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:

 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




More information about the Users mailing list