CQL filter documentation wrongly reports ability to do a BBOX against a geometry
When attempting to a BBOX CQL filter against geometric shapes like POLYGON, GeoServer errors out with an exception:
org.geotools.filter.LiteralExpressionImpl cannot be cast to org.opengis.filter.Filter
According to the documentation at http://docs.geoserver.org/2.7.1/user/filter/ecql_reference.html#spatial-predicate it seems like you should be able to do a BBOX query against a geometric shape like a POLYGON. Other spatial predicates appear to work correctly.
An example of this issue is the following request:
Mass closing all resolved issues not modified in the last 4 weeks
Checked, the issue is with the documentation. There is no way in GeoTools to build a bbox filter against a geometry or an expression, it has to be a plain minx,miny,maxx,maxy bounding box. I'll amend the docs
Using BBOX in CQL is useful when one needs to create a complex query with other predicates, something that is not otherwise allowed by the WFS spec, stating that just one of BBOX,FEATUREID should be used (and by extension, CQL too, one cannot do BBOX and CQL at the same time)
You mean this part:
BBOX ( Expression , Expression | Geometry ) Tests whether a geometry intersects a bounding box specified by a geometric value computed by a function or provided by a geometry literal.
I do not really know how the code is supposed to work. Without further processing it seems that it can only work if Expression is returning an Envelope or if Geometry is of "A custom type of Envelope". It can also be that BBOX should take the Envelope of any Expression or Geometry and pass it on as an org.opengis.filter. Some real developer hopefully tells the truth for us.
Maybe more of a bug in the GeoServer spatial predicate documentation then?