0

I am running a GetFeature request against a WFS server which does not support to download all data at once. I have 910 features and only 200 are visualized. Here is what I tried:

http://localhost:8080/geoserver/pqi_data/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=pqi_data%3Acentros_saude_4326&maxFeatures=200&outputFormat=text%2Fjavascript

My WFS version is 1.0.0 (old) and my GeoServer is 2.16.

I found startindex option but it never works. I think that is due to the versions.

If I changed the parameter maxFeatures to 910, an error appears and the log file has this content:

2020-06-18 11:57:32,757 INFO [geoserver.wfs] - 
Request: getServiceInfo
2020-06-18 11:57:32,767 INFO [geoserver.wfs] - 
Request: getFeature
    service = WFS
    version = 1.0.0
    baseUrl = http://localhost:8080/geoserver/
    query[0]:
        typeName[0] = {pqi_data.com}centros_saude_4326
    maxFeatures = 910
    outputFormat = text/javascript
    resultType = results
2020-06-18 11:57:32,770 INFO [wfs.json] - about to encode JSON
2020-06-18 11:57:32,839 INFO [geoserver.servlets] - OutputStream was successfully aborted.
2020-06-18 11:57:32,839 ERROR [geoserver.ows] - 
org.geoserver.platform.ServiceException: Error: JSON does not allow non-finite numbers
    at org.geoserver.wfs.json.GeoJSONGetFeatureResponse.write(GeoJSONGetFeatureResponse.java:157)
    at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:198)
    at org.geoserver.ows.Dispatcher.response(Dispatcher.java:1031)
    at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:269)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
    at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:26)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:69)
    at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:73)
    at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)
    at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:41)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:37)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:51)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
    at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:81)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
    at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:142)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:101)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.geoserver.filters.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:79)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:42)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:152)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:505)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
    at java.lang.Thread.run(Thread.java:748)
Caused by: net.sf.json.JSONException: JSON does not allow non-finite numbers
    at net.sf.json.util.JSONUtils.testValidity(JSONUtils.java:597)
    at net.sf.json.util.JSONUtils.numberToString(JSONUtils.java:443)
    at net.sf.json.util.JSONUtils.valueToString(JSONUtils.java:668)
    at net.sf.json.util.JSONBuilder.value(JSONBuilder.java:326)
    at org.geoserver.wfs.json.GeoJSONBuilder.value(GeoJSONBuilder.java:381)
    at org.geoserver.wfs.json.GeoJSONBuilder.value(GeoJSONBuilder.java:34)
    at net.sf.json.util.JSONBuilder.value(JSONBuilder.java:302)
    at org.geoserver.wfs.json.GeoJSONBuilder.roundedValue(GeoJSONBuilder.java:208)
    at org.geoserver.wfs.json.GeoJSONBuilder.writeCoordinate(GeoJSONBuilder.java:188)
    at org.geoserver.wfs.json.GeoJSONBuilder.writeCoordinate(GeoJSONBuilder.java:137)
    at org.geoserver.wfs.json.GeoJSONBuilder.writeGeom(GeoJSONBuilder.java:67)
    at org.geoserver.wfs.json.GeoJSONGetFeatureResponse.encodeSimpleFeatures(GeoJSONGetFeatureResponse.java:428)
    at org.geoserver.wfs.json.GeoJSONGetFeatureResponse.writeFeatures(GeoJSONGetFeatureResponse.java:210)
    at org.geoserver.wfs.json.GeoJSONGetFeatureResponse.write(GeoJSONGetFeatureResponse.java:133)
    ... 95 more
3
  • Perhaps the issue is in data, see the error Caused by: net.sf.json.JSONException: JSON does not allow non-finite numbers.
    – user30184
    Jun 18 '20 at 11:23
  • But how can I see if the issue is in the data? In the attributes? If I preview in GEOSERVER as GML, it works fine for instance. Jun 18 '20 at 11:25
  • I guess that GML supports non-finite numbers and therefore you do not get an error. Or maybe GML preview is using maxFeatures and the error appears later in the data. Compare with GML output and try to find the plase where "non-finite numbers" appear. Perhaps you can locate the problematic feature by using GeoJSON format and increasing the maxFeatures value from 200 until you get the error.
    – user30184
    Jun 18 '20 at 11:37
1

You told GeoServer that you only wanted 200 features returned when you set maxFeatures=200 in the URL - if you want all the features then don't add a maxFeatures parameter.

Your other problems are that your features contain a NaN or Infinity value that can't be written out using JSON, you will need to fix your data if you want to continue to use JSON as an output format.

9
  • I changed also that parameter to 910. But an error appears. I try with all values and 200 is the maximum accepted. Jun 18 '20 at 10:50
  • If I change the maxFeatures to 910, the following error appears: This page contains the following errors: error on line 1 at column 1: Document is empty Below is a rendering of the page up to the first error. Jun 18 '20 at 10:50
  • any value should work but leaving it out completely is easiest
    – Ian Turton
    Jun 18 '20 at 10:52
  • I try with values > 200 in maxFeatures and I get always the same error. Can you help me? Jun 18 '20 at 10:53
  • 1
    Probably first 200 features don't contain error in data. Try to inspect logs to check which feature/s causes problems. If you try to get more than 200 features, error occur. If you use WFS 1.0.0. then you can iterate features with maxFeatures and startIndex parameters. If you use WFS 2.0.0. then you can use parameters count and startIndex. Jun 18 '20 at 11:36
1

At least with this server maxFeatures and startIndex work as supposed. Or not really, because support for startIndex came in WFS version 2.0, but GeoServers do support it also with older versions.

This returns Illinois

http://demo.geo-solutions.it/geoserver/wfs?service=WFS&version=1.0.0&typename=states&request=GetFeature&maxfeatures=1&startIndex=0

This returns Georgia

http://demo.geo-solutions.it/geoserver/wfs?service=WFS&version=1.0.0&typename=states&request=GetFeature&maxfeatures=1&startIndex=10

Georgia as GeoJSON

http://demo.geo-solutions.it/geoserver/wfs?service=WFS&version=1.0.0&typename=states&request=GetFeature&outputFormat=json&maxfeatures=1&startIndex=10

2
  • I try with the last URL and not working as well. I put maxfeatures=910 Jun 18 '20 at 11:24
  • GeoJSON is not the native format for WFS and GeoServer may not support everything with that outputformat perfectly. I guess that the output as GML is correct demo.geo-solutions.it/geoserver/….
    – user30184
    Jun 18 '20 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.