I wrote a page to show wms and  wfs, at the same time, but I can't get the WFS 
data show. the codes are listed below.It can only show the WMS data , I 
exchange the place of "topp:tasmania_water_bodies" and 
"topp:tasmania_state_boundaries", then it can only show the 
"topp:tasmania_state_boundaries"(WMS). I have check  the checkbox of the 
layerswitch,and these two layers is the of the same place and have the same 
SRS, I have used udig to open them:
 
var map, layer;
map = new OpenLayers.Map('map', {controls:[], 'projection': 'EPSG:4326', 
'units':'degrees'}); 
  OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
          
          var bounds = new 
OpenLayers.Bounds(143.60260815000004,-43.851764249999995,148.71135685000002,-39.370182750000005)
  // setup untiled layer
          untiled = new OpenLayers.Layer.WMS.Untiled(
            "", "http://192.168.6.140:8080/geoserver/wms";,
            {
              layers: 'topp:tasmania_water_bodies',
              styles: '',
              height: '382',
              width: '800',
              srs: 'EPSG:4326',
              format: 'image/png'
            },
               {maxExtent: bounds, maxResolution: 0.019956049609374915, 
projection: "EPSG:4326"}
          );
          untiled.ratio=1;
          untiled.setVisibility(false, false);
       map.addLayer(untiled);
       var roads = new OpenLayers.Layer.WFS(
                "Roads (WFS)", 
                "http://192.168.6.140:8080/geoserver/wfs?";,
                {   
               layers: 'topp:tasmania_state_boundaries',
                request: 'GetFeature',
                    maxfeatures: 100, visibility:true
                  },
 {maxExtent: bounds, maxResolution: 0.019956049609374915, projection: 
"EPSG:4326"});
       map.addControl(new OpenLayers.Control.PanZoomBar({div:$('nav')}));
          map.addControl(new OpenLayers.Control.MouseDefaults());
          map.addControl(new OpenLayers.Control.Scale($('scale')));
          map.addControl(new OpenLayers.Control.MousePosition({element: 
$('position')}));
          map.addControl(new OpenLayers.Control.LayerSwitcher());
          map.addControl(new OpenLayers.Control.OverviewMap());
          map.zoomToExtent(bounds);
          
                                                                                
  lorkyo

 
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to