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"> <NamedLayer> <UserStyle> <FeatureTypeStyle> <Transformation> <!-- exactly as per in the references above --> </Transformation> <Rule> <ogc:Filter> <!-- I want this filter to be applied before the Transformation --> </ogc:Filter> <PointSymbolizer> </PointSymbolizer> <TextSymbolizer> </TextSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor>
GeoServer v2.7.2 with OpenLayers 3.9.0. The WPS extension is installed (required for the transformation).