[OpenLayers-Users] Layer.Vector with Protocol.WFS will not show

paweluz paweluz at o2.pl
Thu Mar 11 06:56:05 EST 2010


Hi!


I have very similar problem. I can see my data via WMS and WFS layer but not
with Vector layer with WFSProtocol. BTW I use GWT and Openlayers - so it may
be a little different but I do not really think so... I use the nightly
version of Openlayers... I am trying to display sample data from geoserver
(tasmania_roads)

My code for Vector Layer
   
     public final String WFS_URL="http://localhost:8080/geoserver/wfs";

     private void createVectorLayer(){	
    	     VectorOptions vectorOptions = new VectorOptions();
    	     vectorOptions.setStyleMap(My_style());	
    	     vectorOptions.setIsBaseLayer(false);
        WFSProtocolOptions wfsProtocolOptions = new WFSProtocolOptions();
        wfsProtocolOptions.setUrl(WFS_URL);
        wfsProtocolOptions.setGeometryName("the_geom");
        wfsProtocolOptions.getJSObject().setProperty("featureType",
"tasmania_roads");
        wfsProtocolOptions.getJSObject().setProperty("featureNS",
"http://www.openplans.org/topp");
        WFSProtocol wfsProtocol = new WFSProtocol(wfsProtocolOptions);
        VectorOptions vectorOptions =  new VectorOptions();
        vectorOptions.getJSObject().setProperty("protocol",
wfsProtocol.getJSObject());
        vectorLayer = new Vector("Vector Layer", vectorOptions );
    }

My code for WFS layer

 private void createWFSLayer(){	
    	WFSParams wfsParams = new WFSParamsExt();
    	wfsParams.getJSObject().setProperty("extractAttributes",true);
    	wfsParams.getJSObject().setProperty("srs", "EPSG:4326");
    	wfsParams.getJSObject().setProperty("typename", "topp:tasmania_roads");
    	wfsParams.getJSObject().setProperty("featureNS",
"http://www.openplans.org/topp");
    	WFSOptions wfsOptions = new WFSOptions();
    	wfsOptions.setStyleMap(setStyleForWFSLayer());
    wfsLayer = new WFS( "Wfs Layer",WFS_URL , wfsParams, wfsOptions );
    wfsLayer.setIsBaseLayer(false);  
 }


Maybe someone knows why it does not work??

regards,
Poul

-- 
View this message in context: http://n2.nabble.com/Layer-Vector-with-Protocol-WFS-will-not-show-tp4715236p4715493.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list