I'm using GeoServer 2.9.0 and I need to get some result using CQL_FILTER, intersects between polygon and line String layer, cql query is as follow:

INTERSECTS(geom, collectGeometries(queryCollection('workspace:line_string_layer', 'geom', 'IN(''line_string_layer.23'')')))

The full requested url is


But the result return as follow

<?xml version="1.0" encoding="UTF-8"?>
    <ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" 
     <ows:Exception exceptionCode="NoApplicableCode">
         <ows:ExceptionText>java.lang.IllegalStateException: The query 
              in queryCollection returns too many features, the limit is 
              1000 The query in queryCollection returns too many features, 
              the limit is 1000

How to increase this queryCollection limit or am I doing something wrong?

1 Answer 1


Something that could be related is documented in http://docs.geoserver.org/stable/en/user/extensions/querylayer/index.html

Memory limits

The queryCollection and collectGeometries functions do not perform a true database-style join. Instead they execute a query against the secondary layer every time they are executed, and load the entire result into memory. The functions thus risk using excessive server memory if the query result set is very large, or if the collected geometries are very large. To prevent impacting server stability there are built-in limits to how much data can be processed:

  • at most 1000 features are collected by queryCollection
  • at most 37000 coordinates (1MB worth of Coordinate objects) are collected by collectGeometries

These limits can be overridden by setting alternate values for the following parameters (this can be done using JVM system variables, servlet context variables, or enviroment variables):

  • QUERY_LAYER_MAX_FEATURES controls the maximum number of features collected by queryCollection
  • GEOMETRY_COLLECT_MAX_COORDINATES controls the maximum number of coordinates collected by collectGeometries

However, you seem to use maxFeatures=500000000 and you will probably take a risk by inreasing QUERY_LAYER_MAX_FEATURES to such a high number.

  • Thanks for your reply. Is their any limit operation on GetFeature request as i don't have to request maxFeature=50000000 at once?
    – atanu
    Aug 23, 2018 at 12:09
  • I don't know how well querylayers play together with WFS paging with startIndex and count docs.geoserver.org/stable/en/user/services/wfs/basics.html. Have a try by using &startindex=1000&count=1000instead of maxFeatures in your query. If it works just adjust the startindex for sliding the window for the data. But it affects only the main feature type (polygons) not the joined layer (strings). Perhaps you must gather all the polygon and line data and make the comparison on the client side.
    – user30184
    Aug 23, 2018 at 13:22

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.