[Geoserver-users] <And> <Or> filtering problem

hi,
I think I'm missing something about OGC schemas but can't find the way to
solve it.
I just want to make use of And/Or filters in an sLD, but the message arises
in Geoserver:

cvc-complex-type.2.4.b: The content of element 'Or' is not complete. One of
'{"http://www.opengis.net/ogc&quot;:comparisonOps,
"http://www.opengis.net/ogc&quot;:spatialOps,
"http://www.opengis.net/ogc&quot;:logicOps\}' is expected.

The Spatial (intersects, bbox...) and logical (And, Or) Operators should
appear in the GetCapabilities documents? it really doesn't in my Geoserver
(http://edit3.csic.es:80/geoserver/wms?request=getCapabilities)

The SLD (should show only the Bubas genus of the userid Joe) :

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
     xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd"
        xmlns="http://www.opengis.net/sld&quot;
        xmlns:ogc="http://www.opengis.net/ogc&quot;
        xmlns:xlink="http://www.w3.org/1999/xlink&quot;
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt; <NamedLayer>
    <Name>scarabeidos</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Name>Bubas</Name>
          <Filter xmlns="http://www.opengis.net/ogc&quot;&gt;

      <And>
              <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>userid</ogc:PropertyName>
                <ogc:Literal>Joe</ogc:Literal>
              </ogc:PropertyIsEqualTo>
    
     <Or>
    
       <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>genus</ogc:PropertyName>
                <ogc:Literal>Bubas</ogc:Literal>
              </ogc:PropertyIsEqualTo>
     </Or>
      </And>
  </Filter>

  <PointSymbolizer>
      <Fill>
        <CssParameter name="fill" >#FFFFFF</CssParameter>
      </Fill>
  </PointSymbolizer>
          
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I've tried many things (<logicOps:And> , <ogc:And>, <sld:And>...)with no
success.
Thanks,

Pere
--
View this message in context: http://www.nabble.com/<And>-<Or>-filtering-problem-tp15001112p15001112.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi Pere,

Your Or filter only has a single comparison operator inside of it. And
and Or must have at a minimum two. If you only require one you can
simply remove the Or.

Another thing I notice is that your Filter,And, and Or elements do not
have a prefix on them. Which means they are being assumed to be in the
"sld" namespace, which is incorrect. They should be in the ogc namespace.

-Justin

pere roca wrote:

hi,
I think I'm missing something about OGC schemas but can't find the way to
solve it.
I just want to make use of And/Or filters in an sLD, but the message arises
in Geoserver:

cvc-complex-type.2.4.b: The content of element 'Or' is not complete. One of
'{"http://www.opengis.net/ogc&quot;:comparisonOps,
"http://www.opengis.net/ogc&quot;:spatialOps,
"http://www.opengis.net/ogc&quot;:logicOps\}' is expected.

The Spatial (intersects, bbox...) and logical (And, Or) Operators should
appear in the GetCapabilities documents? it really doesn't in my Geoserver
(http://edit3.csic.es:80/geoserver/wms?request=getCapabilities)

The SLD (should show only the Bubas genus of the userid Joe) :

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
     xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd"
        xmlns="http://www.opengis.net/sld&quot;
        xmlns:ogc="http://www.opengis.net/ogc&quot;
        xmlns:xlink="http://www.w3.org/1999/xlink&quot;
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt; <NamedLayer>
    <Name>scarabeidos</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Name>Bubas</Name>
          <Filter xmlns="http://www.opengis.net/ogc&quot;&gt;

      <And>
              <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>userid</ogc:PropertyName>
                <ogc:Literal>Joe</ogc:Literal>
              </ogc:PropertyIsEqualTo>
    
     <Or>
    
       <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>genus</ogc:PropertyName>
                <ogc:Literal>Bubas</ogc:Literal>
              </ogc:PropertyIsEqualTo>
     </Or>
      </And>
  </Filter>

  <PointSymbolizer>
      <Fill>
        <CssParameter name="fill" >#FFFFFF</CssParameter>
      </Fill>
  </PointSymbolizer>
          
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I've tried many things (<logicOps:And> , <ogc:And>, <sld:And>...)with no
success.
Thanks,

Pere

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

this filter works for me :
        <ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;&gt;
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>altitude</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>5001</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>10000</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>

hope it could helps...

pere roca a écrit :

hi,
I think I'm missing something about OGC schemas but can't find the way to
solve it.
I just want to make use of And/Or filters in an sLD, but the message arises
in Geoserver:

cvc-complex-type.2.4.b: The content of element 'Or' is not complete. One of
'{"http://www.opengis.net/ogc&quot;:comparisonOps,
"http://www.opengis.net/ogc&quot;:spatialOps,
"http://www.opengis.net/ogc&quot;:logicOps\}' is expected.

The Spatial (intersects, bbox...) and logical (And, Or) Operators should
appear in the GetCapabilities documents? it really doesn't in my Geoserver
(http://edit3.csic.es:80/geoserver/wms?request=getCapabilities)

The SLD (should show only the Bubas genus of the userid Joe) :

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld
StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld&quot; xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt; <NamedLayer>
    <Name>scarabeidos</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Name>Bubas</Name>
          <Filter xmlns="http://www.opengis.net/ogc&quot;&gt;

      <And>
              <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>userid</ogc:PropertyName>
                <ogc:Literal>Joe</ogc:Literal>
              </ogc:PropertyIsEqualTo>
    
     <Or>
           <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>genus</ogc:PropertyName>
                <ogc:Literal>Bubas</ogc:Literal>
              </ogc:PropertyIsEqualTo>
     </Or>
      </And>
  </Filter>

  <PointSymbolizer>
      <Fill>
        <CssParameter name="fill" >#FFFFFF</CssParameter>
      </Fill>
  </PointSymbolizer>
                  </Rule>
       </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I've tried many things (<logicOps:And> , <ogc:And>, <sld:And>...)with no
success. Thanks,

Pere
  
--
Sébastien Geindre
DPREVI/AERO/DEV
sebastien.geindre __at__ meteo.fr