So I've managed to superimpose a Google layer with my WMS mapserver layers.
I have now a strange behaviour though. While in Firefox everything goes ok, in IExplorer the WMS map center well, but Google maps don't align. They seem shifted on the upper left corner, showing a gray border on the right and bottom side, until I click on the map or zoom: after one operation, they align well. Same thing happens when I change Google layer, f.ex. from Satellite to Hybrid: on the change, the map loses its alignment to gain it again when I do whatever operation on the map. Maybe there is a CSS align problem or what? I emphasize that my code is embedded this way in a CMS (Joomla, as static content): (note, there's no init() function on BODY onLoad event, the script is directly executed) ... JOOMLA CODE ... <div id="map" style="width: 500px;height: 500px;border: 1px solid gray;"></div> <script src='http://maps.google.com/maps?file=api&v=2&key=MYGOOGLEKEY'></script> <script src="../lib/OpenLayers.js"></script> <script src="../Firebug/firebug.js"></script> <script type="text/javascript"> var map; OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3; OpenLayers.Util.onImageLoadErrorColor = "transparent"; delta=480000; mapx=1600000; mapy=4800000; var myWMSMap = "http://path/to/mapserv?map=/path/to/mapfile.map"; var maxEx = new OpenLayers.Bounds(mapx,mapy,mapx+delta,mapy+delta); var resEx = maxEx; var options = {projection: "EPSG:26592",units: "m",maxResolution: 1300,maxExtent: maxEx,restrictedExtent: resEx}; map = new OpenLayers.Map('map', options); // create Google Mercator layers var gmap = new OpenLayers.Layer.Google("Google Strade",{'sphericalMercator': true}); var gsat = new OpenLayers.Layer.Google("Google Satellite",{type: G_SATELLITE_MAP, 'sphericalMercator': true}); var ghyb = new OpenLayers.Layer.Google("Google Ibrida",{type: G_HYBRID_MAP, 'sphericalMercator': true}); var osm_wms = new OpenLayers.Layer.WMS( "Comuni",myWMSMap,{layers: "comuni",transparent: "true", format: "png", projection:'epsg:4326'}); map.addLayers([gmap,gsat,ghyb,osm_wms]); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.EditingToolbar(vector)); map.addControl(new OpenLayers.Control.MousePosition()); map.addControl(new OpenLayers.Control.Scale()); var panel = new OpenLayers.Control.NavToolbar(); map.addControl(panel); map.zoomToMaxExtent(); </script> ... REST OF JOOMLA CODE ... Another 2 questions: - I figured out mapExtent by trial and error, but which is the projection the coords refer to? They seem to be wrong. - Why are coords and the google logo on the upper left corner? -- View this message in context: http://www.nabble.com/Google-layer-not-centering-well-%2B-minor-things-tp14803541p14803541.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
