[Geoserver-users] pass view params in WFS call?

Yes very odd. I am certain my query always returns the same columns as it's effectively just

select * from links where id in (<variable stuff here>)

But I made a test sql view that is simply

select * from links

and found that even not passing any viewparams I can get the same errors. The view has a primary key identified as well as the geometry type and srid. So here is what I am testing with (I tried version 1.1.0 but didn't see any appreciable difference). I can give full logs if you want but I don't think they offer more than the snippets shown. But let me know if I can try anything else or get you any more info. Please ignore any timestamp differences as I first had the debugging profile at GEOSERVER_DEVELOPER_LOGGING and switched to GEOTOOLS_DEVELOPER_LOGGING to get the sql. Sorry in advance for the long email.

My very simple test query is

/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=myns:test_sql_view&maxFeatures=50&outputFormat=[csv|excel|GML2|GML3|json]

CSV: results look sane and no errors in the logs. I did notice however that the geometry are LINESTRING when in fact the geometry is multilinestring (with only one linestring). I only mention it because the other formats don't seem to try convert the multilinestrings to linestrings.

2010-12-02 11:20:34,883 DEBUG [org.geotools.jdbc] - SELECT "gid","link_id","st_name","feat_id","ref_in_id","nref_in_id","func_class","speed_cat","fr_spd_lim","to_spd_lim","to_lanes","from_lanes","dir_travel","route_type","dironsign","source_zlevel","target_zlevel","source","target","length","x1","y1","x2","y2","normalized","st_name_added","dironsign_added","ramp",encode(ST_AsBinary(ST_Force_2D("the_geom")),'base64') as "the_geom" FROM (select * from links) as "vtable" LIMIT 50

Excel: Just for completeness. This fails like it is not supported (docs say excel and I tried excel and Excel)

        2010-12-02 10:50:48,186 ERROR [org.geoserver.ows] -
java.lang.RuntimeException: No response: ( object = class net.opengis.wfs.impl.FeatureCollectionTypeImpl, outputFormat = excel )
        at org.geoserver.ows.Dispatcher.response(Dispatcher.java:713)

GML2 (and GML2-GZIP): I get results but null geometries. The log shows

2010-12-02 10:47:25,264 WARN [org.geotools.jdbc] - Failed to use ST_Estimated_Extent, falling back on envelope aggregation
org.postgresql.util.PSQLException: ERROR: relation "public.test_sql_view" does not exist
  Where: SQL statement "SELECT has_table_privilege((SELECT usesysid FROM pg_user WHERE usename = session_user), 'public.test_sql_view', 'select')"
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.geotools.data.postgis.PostGISDialect.getOptimizedBounds(PostGISDialect.java:208)
        at org.geotools.jdbc.JDBCDataStore.getBounds(JDBCDataStore.java:1086)
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(JDBCFeatureSource.java:468)
        at org.geotools.data.store.ContentFeatureSource.getBounds(ContentFeatureSource.java:369)
        at org.geotools.data.store.ContentFeatureCollection.getBounds(ContentFeatureCollection.java:273)
        at org.geotools.gml.producer.FeatureTransformer$FeatureTranslator.encode(FeatureTransformer.java:498)
        at org.geotools.xml.transform.TransformerBase$XMLReaderSupport.parse(TransformerBase.java:714)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
        at org.geotools.xml.transform.TransformerBase$Task.run(TransformerBase.java:296)
        at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:129)
        at org.geotools.xml.transform.TransformerBase.transform(TransformerBase.java:108)
        at org.geoserver.wfs.xml.GML2OutputFormat.encode(GML2OutputFormat.java:281)

2010-12-02 11:23:19,149 DEBUG [org.geotools.jdbc] - Retriving bounding box: SELECT ST_AsText(ST_Force_2D(Envelope(ST_Extent("the_geom"::geometry))))FROM ( SELECT * FROM (select * from links) as "vtable" LIMIT 50) as "GT2_BOUNDS_"
2010-12-02 11:23:19,150 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION
2010-12-02 11:23:19,151 DEBUG [org.geotools.jdbc] - CREATE CONNECTION
2010-12-02 11:23:19,151 DEBUG [org.geotools.jdbc] - SELECT "gid","link_id","st_name","feat_id","ref_in_id","nref_in_id","func_class","speed_cat","fr_spd_lim","to_spd_lim","to_lanes","from_lanes","dir_travel","route_type","dironsign","source_zlevel","target_zlevel","source","target","length","x1","y1","x2","y2","normalized","st_name_added","dironsign_added","ramp",encode(ST_AsBinary(ST_Force_2D("the_geom")),'base64') as "the_geom" FROM (select * from links) as "vtable" LIMIT 50
2010-12-02 11:23:19,153 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,153 DEBUG [org.geotools.jdbc] - 1 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,153 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,153 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,153 TRACE [org.geotools.gml.producer] - ENTRY LINESTRING (-74.61006 41.13261, -74.61015 41.13271, -74.61021 41.13283, -74.6102 41.13291, -74.61016 41.133)
2010-12-02 11:23:19,153 TRACE [org.geotools.gml.producer] - RETURN {0}
2010-12-02 11:23:19,154 DEBUG [org.geotools.jdbc] - 3 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,154 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,154 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,154 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,154 TRACE [org.geotools.gml.producer] - ENTRY LINESTRING (-75.14668 40.6564, -75.14749 40.6557)
2010-12-02 11:23:19,154 TRACE [org.geotools.gml.producer] - RETURN {0}
2010-12-02 11:23:19,154 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,154 DEBUG [org.geotools.jdbc] - 3 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,154 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:23:19,154 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion

GML3: Seems to return valid results (although I have not gone and tried this in my app) but do get odd errors in the logs. I don't have a column named dead_end and this query seems completely unrelated (but perhaps some other query I once might have had - could I have some corruption somewhere?)

2010-12-02 11:28:53,102 DEBUG [org.geotools.jdbc] - Gathering sql view result structure: select * from (select l.* from links l, vertices_tmp t
where (l.source = t.id or l.target = t.id) and t.cnt=1) as "vtable" LIMIT 0
2010-12-02 11:28:53,103 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION
2010-12-02 11:28:53,103 WARN [org.geoserver.wfs] - Could not load underlying feature type for type dead_end
java.io.IOException: Error looking up primary key
        at org.geotools.jdbc.JDBCDataStore.getPrimaryKey(JDBCDataStore.java:913)
        at org.geotools.jdbc.JDBCFeatureSource.<init>(JDBCFeatureSource.java:81)
        at org.geotools.jdbc.JDBCDataStore.createFeatureSource(JDBCDataStore.java:767)
        at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:384)
        at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:349)
        at org.geotools.data.store.ContentDataStore.getSchema(ContentDataStore.java:334)
        at org.geotools.jdbc.JDBCDataStore.addVirtualTable(JDBCDataStore.java:277)
        at org.geoserver.catalog.ResourcePool.getFeatureType(ResourcePool.java:634)
        at org.geoserver.catalog.ResourcePool.getFeatureType(ResourcePool.java:597)
        at org.geoserver.catalog.impl.FeatureTypeInfoImpl.getFeatureType(FeatureTypeInfoImpl.java:86)
        at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.geoserver.catalog.impl.ModificationProxy.invoke(ModificationProxy.java:144)
        at $Proxy11.getFeatureType(Unknown Source)
        at org.geoserver.wfs.xml.v1_1_0.WFSConfiguration.configureContext(WFSConfiguration.java:226)
        at org.geotools.xml.Configuration.setupContext(Configuration.java:619)
        at org.geotools.xml.Encoder.<init>(Encoder.java:229)
        at org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:149)
        at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:139)
        at org.geoserver.ows.Dispatcher.response(Dispatcher.java:775)
        at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:233)
        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:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:48)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        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:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.postgresql.util.PSQLException: ERROR: column t.cnt does not exist
  Position: 105
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.geotools.jdbc.JDBCFeatureSource.getColumnMetadata(JDBCFeatureSource.java:681)
        at org.geotools.jdbc.JDBCDataStore.getPrimaryKey(JDBCDataStore.java:881)
        ... 75 more
2010-12-02 10:51:36,545 DEBUG [org.geoserver.wfs] - Unable to find user-defined schema location for: http://myns.org/. Using a built schema location by default: http://test.myns.com:8083/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=myns%3Atest_sql_view
2010-12-02 10:51:36,547 WARN [org.geotools.jdbc] - Failed to use ST_Estimated_Extent, falling back on envelope aggregation
org.postgresql.util.PSQLException: ERROR: relation "public.test_sql_view" does not exist
  Where: SQL statement "SELECT has_table_privilege((SELECT usesysid FROM pg_user WHERE usename = session_user), 'public.test_sql_view', 'select')"
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.geotools.data.postgis.PostGISDialect.getOptimizedBounds(PostGISDialect.java:208)
        at org.geotools.jdbc.JDBCDataStore.getBounds(JDBCDataStore.java:1086)
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(JDBCFeatureSource.java:468)
        at org.geotools.data.store.ContentFeatureSource.getBounds(ContentFeatureSource.java:369)
        at org.geotools.data.store.ContentFeatureCollection.getBounds(ContentFeatureCollection.java:273)
        at org.geoserver.wfs.xml.v1_1_0.FeatureCollectionTypeBinding.getProperty(FeatureCollectionTypeBinding.java:180)
        at org.geotools.xml.impl.GetPropertyExecutor.visit(GetPropertyExecutor.java:91)
        at org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:215)
        at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:181)
        at org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:44)
        at org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:29)
        at org.geotools.xml.impl.BindingPropertyExtractor.properties(BindingPropertyExtractor.java:83)
        at org.geotools.xml.Encoder.encode(Encoder.java:904)
        at org.geotools.xml.Encoder.encode(Encoder.java:561)
        at org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:199)
        at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:139)
2010-12-02 11:28:53,107 DEBUG [org.geotools.jdbc] - Retriving bounding box: SELECT ST_AsText(ST_Force_2D(Envelope(ST_Extent("the_geom"::geometry))))FROM ( SELECT * FROM (select * from links) as "vtable" LIMIT 50) as "GT2_BOUNDS_"
2010-12-02 11:28:53,109 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION
2010-12-02 11:28:53,109 DEBUG [org.geotools.xml] - [ class org.geotools.geometry.DirectPosition2D ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,109 DEBUG [org.geotools.xml] - [ class org.geotools.geometry.DirectPosition2D ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,110 DEBUG [org.geotools.jdbc] - CREATE CONNECTION
2010-12-02 11:28:53,110 DEBUG [org.geotools.jdbc] - SELECT "gid","link_id","st_name","feat_id","ref_in_id","nref_in_id","func_class","speed_cat","fr_spd_lim","to_spd_lim","to_lanes","from_lanes","dir_travel","route_type","dironsign","source_zlevel","target_zlevel","source","target","length","x1","y1","x2","y2","normalized","st_name_added","dironsign_added","ramp",encode(ST_AsBinary(ST_Force_2D("the_geom")),'base64') as "the_geom" FROM (select * from links) as "vtable" LIMIT 50
2010-12-02 11:28:53,112 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,112 DEBUG [org.geotools.jdbc] - 1 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,112 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,112 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,112 DEBUG [org.geotools.xml] - _Feature is abstract
2010-12-02 11:28:53,113 DEBUG [org.geotools.xml] - [ class org.geotools.geometry.DirectPosition2D ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,113 DEBUG [org.geotools.xml] - [ class org.geotools.geometry.DirectPosition2D ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,115 DEBUG [org.geotools.xml] - [ class [Lorg.opengis.geometry.DirectPosition; ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,115 DEBUG [org.geotools.jdbc] - 3 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,115 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,115 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,115 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,116 DEBUG [org.geotools.xml] - _Feature is abstract

JSON: fails with

2010-12-02 11:35:53,246 DEBUG [org.geotools.jdbc] - CREATE CONNECTION
2010-12-02 11:35:53,246 DEBUG [org.geotools.jdbc] - SELECT "gid","link_id","st_name","feat_id","ref_in_id","nref_in_id","func_class","speed_cat","fr_spd_lim","to_spd_lim","to_lanes","from_lanes","dir_travel","route_type","dironsign","source_zlevel","target_zlevel","source","target","length","x1","y1","x2","y2","normalized","st_name_added","dironsign_added","ramp",encode(ST_AsBinary(ST_Force_2D("the_geom")),'base64') as "the_geom" FROM (select * from links) as "vtable" LIMIT 50
2010-12-02 11:35:53,248 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:35:53,248 DEBUG [org.geotools.jdbc] - 1 is not of type java.lang.Short, attempting conversion
2010-12-02 11:35:53,248 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:35:53,248 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:35:53,249 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION
2010-12-02 11:35:53,249 ERROR [org.geoserver.ows] -
org.geoserver.platform.ServiceException: Error: Misplaced endArray.
        at org.geoserver.wfs.response.GeoJSONOutputFormat.write(GeoJSONOutputFormat.java:266)
        at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:139)
        at org.geoserver.ows.Dispatcher.response(Dispatcher.java:775)
        at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:233)
        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:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:48)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        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:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)
Caused by: net.sf.json.JSONException: Misplaced endArray.
        at net.sf.json.util.JSONBuilder.end(JSONBuilder.java:183)
        at net.sf.json.util.JSONBuilder.endObject(JSONBuilder.java:214)
        at org.geoserver.wfs.response.GeoJSONBuilder.writeGeom(GeoJSONBuilder.java:99)
        at org.geoserver.wfs.response.GeoJSONOutputFormat.write(GeoJSONOutputFormat.java:157)

tia,
charles

----- Original Message -----
From: "Andrea Aime" <andrea.aime@anonymised.com>
To: "Charles Galpin" <cgalpin@anonymised.com>
Cc: geoserver-users@lists.sourceforge.net
Sent: Thursday, December 2, 2010 9:32:29 AM GMT -05:00 US/Canada Eastern
Subject: Re: [Geoserver-users] pass view params in WFS call?

On Thu, Dec 2, 2010 at 3:18 PM, Charles Galpin <cgalpin@anonymised.com> wrote:

Thanks Andrea
I am away from a computer right now but will send some logs later this
morning that perhaps might shed some light on this. The params are going
through but some combination of my SQL and the format returned is the
problem, some returning results, some partial. Gml2 for example throws
exceptions and returns no results. Gml3 returns results with null
geometries. I think csv was ok. One common error was that at some point it
appears to be looking for a table with the name of my view, and then errors
about non-existent columns (postfix)

Odd. One thing comes to mind, the set of parameters can be used to change
the query, but never to change the set of columns returned by it: whatever
happens you're not allowed to change the name or type of the returned
columns, the structure should always be preserved.

Cheers
Andrea

-----------------------------------------------------
Ing. Andrea Aime
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584962313
fax: +39 0584962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-----------------------------------------------------

I was hoping I could move forward using GML3, but the output says 0 features despite then including them!

<wfs:FeatureCollection numberOfFeatures="0" ...>
  <gml:featureMembers>
    <gml:boundedBy/>
    <myns:test_sql_view gml:id="test_sql_view.fid-7b81134_12ca359e616_db5"/>
    <myns:test_sql_view gml:id="test_sql_view.fid-7b81134_12ca359e616_db6"/>
    ..
  <gml:featureMembers>
</wfs:FeatureCollection>

I guess I'll see if I can get the openlayers gml parser to ignore the numberOfFeatures until I can get this sorted out

charles

----- Original Message -----
GML3: Seems to return valid results (although I have not gone and tried this in my app) but do get odd errors in the logs. I don't have a column named dead_end and this query seems completely unrelated (but perhaps some other query I once might have had - could I have some corruption somewhere?)

2010-12-02 11:28:53,102 DEBUG [org.geotools.jdbc] - Gathering sql view result structure: select * from (select l.* from links l, vertices_tmp t
where (l.source = t.id or l.target = t.id) and t.cnt=1) as "vtable" LIMIT 0
2010-12-02 11:28:53,103 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION
2010-12-02 11:28:53,103 WARN [org.geoserver.wfs] - Could not load underlying feature type for type dead_end
java.io.IOException: Error looking up primary key
        at org.geotools.jdbc.JDBCDataStore.getPrimaryKey(JDBCDataStore.java:913)
        at org.geotools.jdbc.JDBCFeatureSource.<init>(JDBCFeatureSource.java:81)
        at org.geotools.jdbc.JDBCDataStore.createFeatureSource(JDBCDataStore.java:767)
        at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:384)
        at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:349)
        at org.geotools.data.store.ContentDataStore.getSchema(ContentDataStore.java:334)
        at org.geotools.jdbc.JDBCDataStore.addVirtualTable(JDBCDataStore.java:277)
        at org.geoserver.catalog.ResourcePool.getFeatureType(ResourcePool.java:634)
        at org.geoserver.catalog.ResourcePool.getFeatureType(ResourcePool.java:597)
        at org.geoserver.catalog.impl.FeatureTypeInfoImpl.getFeatureType(FeatureTypeInfoImpl.java:86)
        at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.geoserver.catalog.impl.ModificationProxy.invoke(ModificationProxy.java:144)
        at $Proxy11.getFeatureType(Unknown Source)
        at org.geoserver.wfs.xml.v1_1_0.WFSConfiguration.configureContext(WFSConfiguration.java:226)
        at org.geotools.xml.Configuration.setupContext(Configuration.java:619)
        at org.geotools.xml.Encoder.<init>(Encoder.java:229)
        at org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:149)
        at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:139)
        at org.geoserver.ows.Dispatcher.response(Dispatcher.java:775)
        at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:233)
        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:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:48)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        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:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.postgresql.util.PSQLException: ERROR: column t.cnt does not exist
  Position: 105
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.geotools.jdbc.JDBCFeatureSource.getColumnMetadata(JDBCFeatureSource.java:681)
        at org.geotools.jdbc.JDBCDataStore.getPrimaryKey(JDBCDataStore.java:881)
        ... 75 more
2010-12-02 10:51:36,545 DEBUG [org.geoserver.wfs] - Unable to find user-defined schema location for: http://myns.org/. Using a built schema location by default: http://test.myns.com:8083/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=myns%3Atest_sql_view
2010-12-02 10:51:36,547 WARN [org.geotools.jdbc] - Failed to use ST_Estimated_Extent, falling back on envelope aggregation
org.postgresql.util.PSQLException: ERROR: relation "public.test_sql_view" does not exist
  Where: SQL statement "SELECT has_table_privilege((SELECT usesysid FROM pg_user WHERE usename = session_user), 'public.test_sql_view', 'select')"
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
        at org.geotools.data.postgis.PostGISDialect.getOptimizedBounds(PostGISDialect.java:208)
        at org.geotools.jdbc.JDBCDataStore.getBounds(JDBCDataStore.java:1086)
        at org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(JDBCFeatureSource.java:468)
        at org.geotools.data.store.ContentFeatureSource.getBounds(ContentFeatureSource.java:369)
        at org.geotools.data.store.ContentFeatureCollection.getBounds(ContentFeatureCollection.java:273)
        at org.geoserver.wfs.xml.v1_1_0.FeatureCollectionTypeBinding.getProperty(FeatureCollectionTypeBinding.java:180)
        at org.geotools.xml.impl.GetPropertyExecutor.visit(GetPropertyExecutor.java:91)
        at org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:215)
        at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:181)
        at org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:44)
        at org.geotools.xml.impl.BindingVisitorDispatch.walk(BindingVisitorDispatch.java:29)
        at org.geotools.xml.impl.BindingPropertyExtractor.properties(BindingPropertyExtractor.java:83)
        at org.geotools.xml.Encoder.encode(Encoder.java:904)
        at org.geotools.xml.Encoder.encode(Encoder.java:561)
        at org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:199)
        at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:139)
2010-12-02 11:28:53,107 DEBUG [org.geotools.jdbc] - Retriving bounding box: SELECT ST_AsText(ST_Force_2D(Envelope(ST_Extent("the_geom"::geometry))))FROM ( SELECT * FROM (select * from links) as "vtable" LIMIT 50) as "GT2_BOUNDS_"
2010-12-02 11:28:53,109 DEBUG [org.geotools.jdbc] - CLOSE CONNECTION
2010-12-02 11:28:53,109 DEBUG [org.geotools.xml] - [ class org.geotools.geometry.DirectPosition2D ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,109 DEBUG [org.geotools.xml] - [ class org.geotools.geometry.DirectPosition2D ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,110 DEBUG [org.geotools.jdbc] - CREATE CONNECTION
2010-12-02 11:28:53,110 DEBUG [org.geotools.jdbc] - SELECT "gid","link_id","st_name","feat_id","ref_in_id","nref_in_id","func_class","speed_cat","fr_spd_lim","to_spd_lim","to_lanes","from_lanes","dir_travel","route_type","dironsign","source_zlevel","target_zlevel","source","target","length","x1","y1","x2","y2","normalized","st_name_added","dironsign_added","ramp",encode(ST_AsBinary(ST_Force_2D("the_geom")),'base64') as "the_geom" FROM (select * from links) as "vtable" LIMIT 50
2010-12-02 11:28:53,112 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,112 DEBUG [org.geotools.jdbc] - 1 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,112 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,112 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,112 DEBUG [org.geotools.xml] - _Feature is abstract
2010-12-02 11:28:53,113 DEBUG [org.geotools.xml] - [ class org.geotools.geometry.DirectPosition2D ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,113 DEBUG [org.geotools.xml] - [ class org.geotools.geometry.DirectPosition2D ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,115 DEBUG [org.geotools.xml] - [ class [Lorg.opengis.geometry.DirectPosition; ] is not of type class [Ljava.lang.Double;
2010-12-02 11:28:53,115 DEBUG [org.geotools.jdbc] - 3 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,115 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,115 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,115 DEBUG [org.geotools.jdbc] - 0 is not of type java.lang.Short, attempting conversion
2010-12-02 11:28:53,116 DEBUG [org.geotools.xml] - _Feature is abstract

On Thu, Dec 2, 2010 at 6:07 PM, Charles Galpin <cgalpin@anonymised.com> wrote:

I was hoping I could move forward using GML3, but the output says 0 features despite then including them!

<wfs:FeatureCollection numberOfFeatures="0" ...>
<gml:featureMembers>
<gml:boundedBy/>
<myns:test_sql_view gml:id="test_sql_view.fid-7b81134_12ca359e616_db5"/>
<myns:test_sql_view gml:id="test_sql_view.fid-7b81134_12ca359e616_db6"/>
..
<gml:featureMembers>
</wfs:FeatureCollection>

I guess I'll see if I can get the openlayers gml parser to ignore the numberOfFeatures until I can get this sorted out

Ah, count! Yeah, it may be a bug, I guess the sql view params may be
lost on the way to the database (a select count(*) ... where ...)
is performed to get the value of the count attribute.

Please open a bug report on jira.codehaus.org

Cheers
Andrea

-----------------------------------------------------
Ing. Andrea Aime
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584962313
fax: +39 0584962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-----------------------------------------------------

Done (GEOS-4245). BTW, it seems openlayers ignores this (or doesn't care it's zero) once properly configured to parse GML3 with the right featureNS and featurePrefix, so I am able to use this.

Any thoughts on why the only output format that works is GML3? The problems look semi random but there are some similarities too. My test is dead simple so it should be easy for someone else to verify the other formats work for them, and if they do, I must have some kind of corrupted layer settings.

Thanks,
charles

On Dec 3, 2010, at 3:22 PM, Andrea Aime wrote:

On Thu, Dec 2, 2010 at 6:07 PM, Charles Galpin <cgalpin@anonymised.com> wrote:

I was hoping I could move forward using GML3, but the output says 0 features despite then including them!

<wfs:FeatureCollection numberOfFeatures="0" ...>
<gml:featureMembers>
   <gml:boundedBy/>
   <myns:test_sql_view gml:id="test_sql_view.fid-7b81134_12ca359e616_db5"/>
   <myns:test_sql_view gml:id="test_sql_view.fid-7b81134_12ca359e616_db6"/>
   ..
<gml:featureMembers>
</wfs:FeatureCollection>

I guess I'll see if I can get the openlayers gml parser to ignore the numberOfFeatures until I can get this sorted out

Ah, count! Yeah, it may be a bug, I guess the sql view params may be
lost on the way to the database (a select count(*) ... where ...)
is performed to get the value of the count attribute.

Please open a bug report on jira.codehaus.org