I'm trying to apply a filter rule in an SLD, before applying the GeoServer PointStacker transformation (which groups points that are too close to distinguish their icons). This transformation is nicely described and demonstrated here and here etc.

Without my filter, the transformation is working fine, and without the transformation, my filter is working fine. My filter must go in the SLD instead of in CQL because it allows certain points to be conditionally displayed at certain zoom levels, depending on an attribute field. I can't seem to find where and how to put in the filter condition without breaking the XML validation (or even a related question on SE).

Below is what I have tried already. I've put the filter in after the transformation, so as to show what I'm trying to achieve. (Of course this does not work for two reasons: 1\ the point-stacker transformation does not return my original fields used in my filter, so the filter no longer works there. 2\ it stacks points which should have been filtered out already by the time the transformation is done.)

I've also tried moving the <ogc:filter> tag and contents to just before the <Transformation>, as well as just inside it - at the start or the end. All these attempts gave XML validation errors.

EDIT: removed fluff from the code here and formatted. The code is exactly as per the first link in par. 1 above, but with a filter added.

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <Transformation>    <!-- exactly as per in the references above -->

          <ogc:Filter>      <!-- I want this filter to be applied before the Transformation  -->




GeoServer v2.7.2 with OpenLayers 3.9.0. The WPS extension is installed (required for the transformation).


I think the traditional answer is that you can't filter the data because it has already been calculated by the time it reaches the transformation process.

It might be possible to filter the data within the rule by chaining WPS functions. The WPS process you would need is probably the vec:Query (or gs:Query) function.

However I believe this is not currently available within the rendering transformations.

| improve this answer | |

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.