OK- so here's what you've got to do.  Start with your working Google map. 
This will set the Google layers as your base layers and the map will have a
sphericalMercator projection.  Add your layers from geoserver as Overlay
layers and they should reproject from EPSG:4326 to EPSG:900913 on-the-fly. 
You were trying to switch between 4326 and 900913 basemaps, which was why
nothing was working correctly.  This should work:


<html> 
  <head> 
    <link rel="stylesheet"
href="http://openlayers.org/api/theme/default/style.css"; type="text/css" /> 
    <link rel="stylesheet"
href="http://openlayers.org/dev/examples/style.css"; type="text/css" /> 
    <script src="http://openlayers.org/dev/OpenLayers.js";></script> 
        <script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false";></script> 
    <script type="text/javascript"> 
    
var map; 

function init() { 

        var options = {
                    maxExtent: new OpenLayers.Bounds(-20037508.34,
-20037508.34, 20037508.34, 20037508.34),
                                        maxResolution: "auto",
                    projection: new OpenLayers.Projection("EPSG:900913"),
                    units: 'm'
                };
        
        map = new OpenLayers.Map('map', options);

    map.addControl(new OpenLayers.Control.LayerSwitcher()); 
     
    var gsat = new OpenLayers.Layer.Google( 
        "Google Satellite", 
        {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22} 
    ); 
        
        var NE_image = new OpenLayers.Layer.WMS( 
                    "Natural Earth", "http://localhost:8080/geoserver/wms";,
{layers: 'cite:NE12', transparent: true}, {isBaseLayer: false}
                ); 
                                
    var arkansas = new OpenLayers.Layer.WMS( 
                    "Arkansas", "http://localhost:8080/geoserver/wms";,
{layers: 'cite:arkansas', transparent: true}, {isBaseLayer: false} 
                ); 

        map.addLayers([gsat,NE_image,arkansas]); 
        
    // Google.v3 uses EPSG:900913 as projection, so we have to 
    // transform our coordinates 
    map.setCenter(new OpenLayers.LonLat(10.2, 48.9).transform( 
        new OpenLayers.Projection("EPSG:4326"), 
        map.getProjectionObject() 
    ), 5); 

        
} 
    </script> 
  </head> 

  <body onload="init()"> 
    <h1 id="title">OpenLayers: Google Layer Example</h1> 
    <div id="map" class="smallmap" style="width: 1500; height: 500"></div> 
  </body> 

</html> 

-----
Bryan R. McBride, GISP
http://www.bryanmcbride.com bryanmcbride.com 
http://geoserving.net/ geoserving.net 
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Geoserver-WMS-Layer-Does-Not-Display-tp5511643p5514913.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to