Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
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 –  iant Jun 20 '12 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. –  GIS-Jonathan Jun 20 '12 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 '12 at 3:14
add comment

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
Yes, I did apply them –  Yun Jun 21 '12 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. –  Andrea Aime Jun 21 '12 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 '12 at 8:01
1  
id is a reserved keyword, try using "id" = 112 –  Andrea Aime Jun 22 '12 at 10:19
    
I see, thanks for that. Very helpful. –  Yun Jun 26 '12 at 3:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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