1

I have a polygon layer (in GeoServer). The goal is to just get the bounding box of a filtered feature. From the (E)CQL docs I thought the boundary filter should do the work, but I could not get it to work. Other threads found on Google didn't even help...

http://localhost:8080/geoserver/wfs/?service=WFS&version=1.1.0&request=GetFeature&typename=topp:states&cql_filter=BOUNDARY(the_geom)&

I always got the following exception: java.lang.ClassCastException: org.geotools.filter.function.FilterFunction_boundary cannot be cast to org.opengis.filter.Filter org.geotools.filter.function.FilterFunction_boundary cannot be cast to org.opengis.filter.Filter

3

This error is trying to tell you a FilterFunction is not a Filter which means that it doesn't evaluate to true or false. The CQL filter is used to select some or all of the features in the data store, but you are trying to use it transform a features' geometry instead.

The usual way to achieve what you are trying is to get GeoServer to return your selected feature (using the CQL filter to select it) and then use JavaScript (or whatever language your client uses) to calculate the bounding box.

If this is beyond the abilities of your client then you could use a WPS process to call the envelope function on a selected feature for you.

  • So I misunderstood the docs...there is really no chance to just get the bounding box without sending back the complete geometry? Something link max x, y values from geom? – Pete Nov 7 '16 at 14:43
  • you are trying to apply a transform in the selection filter, WFS doesn't work that way, try WPS if you must do it on server – Ian Turton Nov 7 '16 at 14:47

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.