[OpenLayers-Users] openlayers+geoserver WFS not display

hh32257 hh32257 at gmail.com
Mon Dec 5 04:00:02 EST 2011


I have tried many methods to solve this problem, but it still doesn't work. 
The layer of  WMS works fine.  But the layer of WFS does not display. I set
up the proxy. 

  OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
   OpenLayers.Lang.setCode('zh-CN');
    
    var map, info,select,selectbus;
    var urlWFS="http://192.168.1.5:8080/geoserver/wfs";
    var urlWMS="http://192.168.1.5:8080/geoserver/wms";
    var fNameSpace="http://192.168.1.5:8080/sf";
    
    function init() {
   
 
        map = new OpenLayers.Map({
        div: "map",
        projection: new OpenLayers.Projection("EPSG:900913"),
        units: "m",
        maxResolution: 156543.0339,
        maxExtent: new OpenLayers.Bounds(
          -20037508, -20037508, 20037508, 20037508.34

        )
    });

         var osm = new OpenLayers.Layer.OSM();
         map.addLayers([osm]);

             var bus=new OpenLayers.Layer.Vector("bus", {
                strategies: [new OpenLayers.Strategy.BBOX()],
                protocol: new OpenLayers.Protocol.WFS({
                    version: "1.1.0",
                    url: urlWFS,
                    featureType: "146Bus",
                    featureNS: fNameSpace,
                    isBaseLayer: false, 
                    visibility:true
                }),
             });

        var busline = new OpenLayers.Layer.WMS("busline",
           urlWMS, 
            {'layers': 'sf:146BusLine', transparent: true, format:
'image/gif'},
            {isBaseLayer: false}
        );

        var stops=new OpenLayers.Layer.Vector("stops", {
                strategies: [new OpenLayers.Strategy.BBOX()],
                protocol: new OpenLayers.Protocol.WFS({
                    version: "1.1.0",
                    url: urlWFS,
                    featureType: "146Stops",
                    featureNS: fNameSpace
                }),
  
        map.addLayers([busline,bus,stops]); 
        bus.refresh();
        stops.refresh();
        map.addControl(new OpenLayers.Control.LayerSwitcher());

        map.setCenter(
        new OpenLayers.LonLat(121.47, 31.21).transform(
            new OpenLayers.Projection("EPSG:4326"),
            map.getProjectionObject()
        ), 
        14
    );




Any ideas will be gratefully received! 

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/openlayers-geoserver-WFS-not-display-tp7062190p7062190.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list