[OpenLayers-Users] WFS can't be shown. Can any one help me?

lorkyo lorkyo at 163.com
Fri Aug 1 11:00:25 EDT 2008


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

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080801/4ecb66ef/attachment.html


More information about the Users mailing list