Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm having some difficulty when using a Logical OR in a WFS query to get multiple postcodes. This code works fine when it's only 1 PropertyIsEqualTo filter, but when I wrap the OR around more than one PropertyIsEqualTo filter I get an exception.

POST http://intranet.nottscc.gov.uk/maps/wfs HTTP/1.1
User-Agent: Fiddler
Content-Type: text/xml
Host: intranet.nottscc.gov.uk
Content-Length: 1875
Expect: 100-continue

<wfs:GetFeature service="WFS" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:ncc="http://nottinghamshire.gov.uk" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<wfs:Query typeName="ncc:OSCodepoint_15KM">
<wfs:PropertyName>ncc:FORMAT1</wfs:PropertyName>
<wfs:PropertyName>ncc:EASTING</wfs:PropertyName>
<wfs:PropertyName>ncc:NORTHING</wfs:PropertyName>
<ogc:Filter>
  <ogc:OR>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>ncc:FORMAT3</ogc:PropertyName>
      <ogc:Literal>NG156LR</ogc:Literal>
    </ogc:PropertyIsEqualTo>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>ncc:FORMAT3</ogc:PropertyName>
      <ogc:Literal>NG163GP</ogc:Literal>
    </ogc:PropertyIsEqualTo>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>ncc:FORMAT3</ogc:PropertyName>
      <ogc:Literal>NG158AY</ogc:Literal>
    </ogc:PropertyIsEqualTo>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>ncc:FORMAT3</ogc:PropertyName>
      <ogc:Literal>NG171ER</ogc:Literal>
    </ogc:PropertyIsEqualTo>
      </ogc:OR>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

This is the Error message I get.

<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://intranet.nottscc.gov.uk/maps/schemas/ows/1.0.0/owsExceptionReport.xsd"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows">
  <ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>Error occurred getting features Invalid fid filter provides, has no fids inside Invalid fid filter provides, has no fids inside</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>

I'm using GeoServer to process the query.

Any help is much appreciated.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Use a capitalized Or instead of all-caps OR to wrap your criteria:

<ogc:Filter>
    <ogc:Or>
        <!-- Criteria -->
    </ogc:Or>
</ogc:Filter>

I can't find any definitive answers about case sensitivity in filters, but the XML schema on the OGC site uses "Or" instead of "OR".

share|improve this answer
    
Thanks very much, my hair is still intact. The mistake was using Mapserver for the examples mapserver.org/ogc/filter_encoding.html where they use CAPITALS and then implementing it with GeoServer where they don't. –  Tom Styles Jan 6 '12 at 8:25
    
XML is case sensitive and it should be Or –  iant Jan 6 '12 at 13:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.