Hi,

I'm currently using geoserver 2.0.2, and it is to my understanding that it should be possible to filter a set of features using the tag "LayerFeatureConstraints" in the sld.

According to the xsd the LayerFeatureConstraint should contain a FeatureTypeConstraint node, which can constrain the features to a specific feature-type as well as giving the opportunity to supply a filter. But I can't get this to work.

I've done some test simply with the demo-data that follows the installation, working with topp:states and the "population" style. The original style contains multiple Rules that specifies certain fill-colours depending on the PERSONS property, and the layer preview tells me that this works.

Then I've simplified the population style, keeping one "generic" rule that sets the same fill-colour to all polygons, but instead I try to apply a LayerFeatureConstraint to only give me the features that have less than 2000000. But it doesn't work. My Sld definition is like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" 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" xmlns:gml="http://www.opengis.net/gml"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>USA states population</Name>
      <LayerFeatureConstraints>
            <FeatureTypeConstraint>
                <ogc:Filter>
                    <ogc:PropertyIsLessThan>
                        <ogc:PropertyName>PERSONS</ogc:PropertyName>
                        <ogc:Literal>2000000</ogc:Literal>
                    </ogc:PropertyIsLessThan>
                </ogc:Filter>
            </FeatureTypeConstraint>
    </LayerFeatureConstraints>
    <UserStyle>
      <Name>population</Name>
     
      <Title>Population in the United States</Title>
      <Abstract>A sample filter that filters the United States into three
        categories of population, drawn in different colors</Abstract>
      <FeatureTypeStyle>
        <Rule>
          <Title>All states</Title>
        
          <PolygonSymbolizer>
             <Fill>
                <!-- CssParameters allowed are fill (the color) and fill-opacity -->
                <CssParameter name="fill">#4DFF4D</CssParameter>
                <CssParameter name="fill-opacity">0.7</CssParameter>
             </Fill>    
          </PolygonSymbolizer>
        </Rule>
       
     </FeatureTypeStyle>
    </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>


Could anyone please supply me with some information regarding this? Am I using it incorrectly, or can it not be used like this? For me it seems like whatever I try to use in the ogc:Filter is simply ignored, unless the filter is put under a Rule node. Then it works immediately.

I have tested this using both shapefiles and layers served from postgresql, and tried also with a spatial filter (bounding box) and featureId filter, but neither seem to make a difference - all features are displayed.

Regards,

Eivind Roennevik
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to