1

I am experimenting with CQL filtering in Geoserver. I have two layers, one (A) has 8000 features, the other one (B) has 3000 features or so. I would like to search of layer A for intersection with layer B's features. Not all of Layer B's features, just a few based on their feature ID.

I've been searching around and I can't find a way yet to do the feature ID + geometry filter, I hope someone can suggest me how to do that.

So in the meantime, I have tried with another attribute I've put in, though, and the CQL Filter is currently like this with WMS:

layers=A
CQL_FILTER=INTERSECTS(the_geom,querySingle('B','the_geom','OBJECTID=6139'))

When I run this in my browser , the query goes forever and timed out. There is an error in the jetty : org.geoserver.platform.ServiceException: This requested used more time than allowed and has been forcefully stopped. Max rendering time is 60.0s

The example from Geoserver (the one using restricted layer vs bug sites) doesn't have this problem. I'm wondering if I'm writing the query wrong, whether my PC's just not up to it, or something else. Should I be doing this in WFS instead?

3
  • what are the speeds of the two queries if you do them separately? That is just to request the polygon from B and the intersects with the B polygon as WKT directly. This will indicate where an index might help
    – Ian Turton
    Jun 20, 2012 at 7:43
  • How long does it take to run the equivalent query directly against the database? That should give you a base-line time; GeoServer can't be faster than that, but any slower and that's GeoServer's fault. Jun 20, 2012 at 9:03
  • One of them are in Shapefile instead of PostGIS. So I can't really do it in PostGIS. I suppose that is the reason why it's so slow? Using shapefiles as data sources?
    – Yun
    Jun 21, 2012 at 3:14

1 Answer 1

2

It seems you are using the cross layer filtering plugin: http://docs.geoserver.org/stable/en/user/extensions/querylayer/index.html

Did you read and apply the hints in the "optimizing the module speed" section? The hint is needed only for the 2.1.x series, the 2.2.x won't benefit from it

4
  • Yes, I did apply them
    – Yun
    Jun 21, 2012 at 3:12
  • Hmm... maybe the geometry retrieved from layer B is very complex and postgis takes a while to evaluate the filter? Not sure. Jun 21, 2012 at 9:12
  • There's a column in my db which is called "id" and whenever I try to query by 'id = 112' it gives me error. Caused by: org.geotools.filter.text.cql2.CQLException: Encountered "id =" at line 1, column 1.
    – Yun
    Jun 22, 2012 at 8:01
  • 1
    id is a reserved keyword, try using "id" = 112 Jun 22, 2012 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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