CQL filter documentation wrongly reports ability to do a BBOX against a geometry

Description

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:

http://demo.boundlessgeo.com/geoserver/wfs?cql_filter=BBOX(%22the_geom%22,+POLYGON((-105.51+43.06,-105.51+47.10,-97.77+47.10,-97.77+43.06,-105.51+43.06)))&outputFormat=text%2Fxml;+subtype%3Dgml%2F3.1.1&request=GetFeature&srsName=EPSG:4326&typeName=og:archsites&version=1.0.0

Environment

Activity

Show:
Andrea Aime
February 15, 2017, 11:48 AM

Mass closing all resolved issues not modified in the last 4 weeks

Andrea Aime
July 22, 2016, 9:55 AM

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

Andrea Aime
July 22, 2016, 9:08 AM

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)

Jukka Rahkonen
October 20, 2015, 9:13 PM

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.

Tony Baron
October 20, 2015, 8:37 PM

Maybe more of a bug in the GeoServer spatial predicate documentation then?

Fixed

Assignee

Andrea Aime

Reporter

Tony Baron

Fix versions