ThinkGeo.com    |     Documentation    |     Premium Support

WFS Service call with WfsFeatureLayer

Hello,


I'm trying to make the WfsFeatureLayer sample in the HowoISamples solution work.


But I'm encoutering several problems :


The base sample works not. It send 0 results.Here is the important code in the sample :


            WfsFeatureLayer wfsFeatureLayer = new WfsFeatureLayer(@"giswebservices.massgis.state.ma.us/geoserver/wfs?request=GetFeature", "massgis:TOWNS_POLYM");

            Collection<string> returningColumns = new Collection<string>();



            FeatureLayer wfsFeatureLayer = wpfMap1.FindFeatureLayer("WfsFeatureLayer");

            wfsFeatureLayer.Open();

            Collection<FeatureSourceColumn> columns = wfsFeatureLayer.FeatureSource.GetColumns();

            foreach (FeatureSourceColumn item in columns)

            {

                returningColumns.Add(item.ColumnName);

            }



            Collection<Feature> allFeaturs = wfsFeatureLayer.QueryTools.GetAllFeatures(returningColumns);

            wfsFeatureLayer.Close();



The result of this is simply a allFeaturs.Count = 0.


However, when I try to execute the theoric query this code must execute, I become many many data. giswebservices.massgis.state.ma.us/geoserver/wfs?request=GetFeature&Service=WFS&typeName=massgis:TOWNS_POLYM

            


I tracked what exactly is send from the WpfClient, and I become the folloqing requested url : giswebservices.massgis.state.ma.us/geoserver/wfs?request=GetFeature?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=massgis:TOWNS_POLYM&propertyname=


and when executing this url direct in a webbrowser, there result is an exception :




<ServiceExceptionReport version="1.2.0" xsi:schemaLocation="opengis.net/ogc schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">



<ServiceException code="OperationNotSupported" locator="GetFeature?SERVICE=WFS">



      No such operation wfs 1.0.0 GetFeature?SERVICE=WFS

Details:

org.geoserver.platform.ServiceException: No such operation wfs 1.0.0 GetFeature?SERVICE=WFS

    at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:399)

    at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:209)

    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)

    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)

    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)

    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)

    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)

    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)

    at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)

    at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)

    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)

    at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)

    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)

    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)

    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)

    at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)

    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)

    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)

    at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)

    at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)

    at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

    at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

    at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:163)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

    at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)

    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

    at java.lang.Thread.run(Thread.java:619)



</ServiceException>

</ServiceExceptionReport>


Then I tried the same experience with another public WFS server : bsc-eoc.org/cgi-bin/bsc_ows.asp?version=1.0.0&service=WFS


While executing the samlpe code with this URL, the execution is locked. 

The line of code Collection<Feature> allFeaturs = wfsFeatureLayer.QueryTools.GetAllFeatures(returningColumns); is executed, but never end.


I tracked what exactly is sent too, and I found the following URL : bsc-eoc.org/cgi-bin/bsc_ows.asp?version=1.0.0&service=WFS&request=GetFeature?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=OWLS&BBOX=-81,45,-79,48&propertyname=msGeometry,ROUTEID,ROUTE_NAME,LATITUDE,LONGITUDE


This URI works good when executing it in a webBrowser, I become a valid WML result.

But the WpfClient seems to be locked somewhere.


 


Could you please give me some advices ?

Thanks

Guillaume.



Guillaume, 
  
  The input parameter “giswebservices.massgis.state.ma.us/geoserver/wfs?request=GetFeature” isn’t right, it should be  
  
 WfsFeatureLayer wfsFeatureLayer = new WfsFeatureLayer(@"giswebservices.massgis.state.ma.us/geoserver/wfs", "massgis:TOWNS_POLYM"); 
  
 Thanks, 
  
 Ben

Hello Ben, 
  
 Sorrt, I muist have seen that the service and request parameters were 2 times in the query. 
 However, it still does not works with the correct URL. 
 I got a timeout, so I tried to load less data, by changing the loaded column (only TOWN_ID and TOWN), but I still get a timeout. 
  
 Another idea ? 
 Thanks, 
 Guillaume.

Guillaume, 


It works fine in my test. but it takes a long time before GetAllFeatures returns the value, so I think it might have a timeout error if the network has some issues.  Please have a look at the following snapshots for detail.
 
 
Thanks,
 
Ben

Guillaume, 
  
 Here is my test code in case you can not see it clearly. 
  
 
  private void DisplayMap_Load(object sender, EventArgs e)
        {
            WfsFeatureLayer wfsFeatureLayer = new WfsFeatureLayer(@"giswebservices.massgis.state.ma.us/geoserver/wfs", "massgis:TOWNS_POLYM");
            wfsFeatureLayer.Open();
            wfsFeatureLayer.GetBoundingBox();
            Collection<FeatureSourceColumn> columns = wfsFeatureLayer.FeatureSource.GetColumns();
            Collection<Feature> features = wfsFeatureLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.NoColumns);
        }
 
  
 Thanks, 
  
 Ben

Ben, 
  
 I just tested your code, and traced which calls are made. I nitoced that 3 URL are called while executing this code : 
 giswebservices.massgis.state.ma.us/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=massgis:TOWNS_POLYM&propertyname=the_geom 
 giswebservices.massgis.state.ma.us/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=massgis:TOWNS_POLYM&maxfeatures=1 
 giswebservices.massgis.state.ma.us/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=massgis:TOWNS_POLYM 
  
 It seems that the result of the first one is really big, and takes time to be loaded. In a webbrowser I can have the result, but it takes almost 1:30 minutes. 
 So I tried changing the typename with a smaller one, and I used massgis:MORIS.SURFICIAL_SEDIMENTS in your code. 
  
 3 URL are called : 
  
 giswebservices.massgis.state.ma.us/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=massgis:MORIS.SURFICIAL_SEDIMENTS 
 giswebservices.massgis.state.ma.us/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=massgis:MORIS.SURFICIAL_SEDIMENTS&maxfeatures=1 
 giswebservices.massgis.state.ma.us/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=massgis:MORIS.SURFICIAL_SEDIMENTS&propertyname=SHAPE 
  
 This time, with a webbrowser, it takes less than 15 seconds for the 3 URLS to load. But when using wfsFeatureLayer.FeatureSource.GetAllFeatures(), I still get a TimeOut. 
  
 Our network seems pretty good though. 
  
 I can see in your screenshot that you get some results, but I cannot, the execution is still locked at the wfsFeatureLayer.FeatureSource.GetAllFeatures() execution, and abort with a TimeOut. 
  
 Is there a way to know exactly where it locks, in order to help me analysing this problem ? 
 Thanks, 
 Guillaume.

Guillaume, 


In my test, if I set it to "massgis:TOWNS_POLYM", it takes 180s for GetAllFeatures(), if I set it to "massgis:MORIS.SURFICIAL_SEDIMENTS", it takes 80s for GetAllFeatures().
 
I tried

giswebservices.massgis.state.ma.us/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=massgis:TOWNS_POLYM&propertyname=the_geom


 
in IE, it quickly give me a response but it takes about 80s to finish loading all the data. Internally we use stream to load the data on the fly which is slower than IE, plus it takes some time to assembly the data, so it is slower than using a browser. Could you have a try how much time it takes to finish loading all the data from the above link?
 
I am using 3.1.299 (last public release) for the test, could you tell me what version you are using?
 
Thanks,
 
Ben