[OpenLayers-Dev] WFS layer not visible

Simone Lella lella.s at irea.cnr.it
Tue Mar 29 03:36:09 EDT 2011


Hi,

I'm using OpenLayers 2.10 and GeoServer 2.0.2.
I wrote the below code to provide a shapefile through WFS, but the layer 
is not visible.
The first is an external layer, the second is a layer inside my 
GeoServer. I'm using the GeoServer Proxy Extension.
How I choose the Strategy?
What I have to type in "featureType"?


...

var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
     renderer = (renderer) ? [renderer] : 
OpenLayers.Layer.Vector.prototype.renderers;

     var wfs = new OpenLayers.Layer.Vector("State", {
         strategies: [new OpenLayers.Strategy.BBOX()],
         protocol: new OpenLayers.Protocol.WFS({
             url: "http://demo.opengeo.org/geoserver/wfs",
             featureType: "states",
             featureNS: "http://www.openplans.org/topp"
         }),
         renderers: renderer
     });
/*-----------------------------------------------------------------------------------------------------------------------------*/
     var wfs_comuni = new OpenLayers.Layer.Vector("Comuni_Garda", {
         strategies: [new OpenLayers.Strategy.BBOX()],
         protocol: new OpenLayers.Protocol.WFS({
             url: "http://localhost:8082/geoserver/wfs",
             featureType: "comuni_wfs"
            //featureNS: "http://www.openplans.org/topp"
         })
     });



map.addLayers([wfs, wfs_comuni]);

...

Thanks

Simone

-- 
Simone Lella
Istituto per il Rilevamento Elettromagnetico dell'Ambiente
IREA - CNR (http://www.irea.cnr.it)
Via Bassini, 15
Tel. +39 02-20133299
Milano



More information about the Dev mailing list