[Geoserver-users] OGC Filter in 1.6.x

Hello:

I am having a problem with using an OGC filter with a getFeature request.

The following filter will not work as expected:

<wfs:GetFeature service="WFS" version="1.0.0"
  outputFormat="GML2"
  xmlns:topp="http://www.openplans.org/topp&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:gml="http://www.opengis.net/gml&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
  <wfs:Query typeName="topp:states">
    <ogc:PropertyName>topp:STATE_NAME</ogc:PropertyName>
    <ogc:PropertyName>topp:PERSONS</ogc:PropertyName>
    <ogc:Filter>
      <ogc:BBOX>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
           <gml:coordinates>-150,20 -72.361859,41.512517</gml:coordinates>
        </gml:Box>
      </ogc:BBOX>
<PropertyIsBetween><PropertyName>PERSONS</PropertyName><LowerBoundary><Literal>400000</Literal></LowerBoundary><UpperBoundary><Literal>1000000</Literal></UpperBoundary></PropertyIsBetween>
   </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

From the logs I see that only the "BBOX" part for the filter gets

parsed, and the "PorpertyIsBetween" portion is ignored:

Request: getFeature
  handle = null
  service = WFS
  version = 1.0.0
  baseUrl = http://localhost:8080/geoserver/
  query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propertyName: [topp:STATE_NAME, topp:PERSONS], function: null, filter:
[ the_geom bbox POLYGON ((-150 20, -150 41.512517, -72.361859
41.512517, -72.361859 20, -150 20)) ], sortBy: null, featureVersion:
null, handle: null, srsName: null, typeName:
[{http://www.openplans.org/topp\}states])]
  maxFeatures = null
  outputFormat = GML2
  resultType = results
  traverseXlinkDepth = null
  traverseXlinkExpiry = null

However, if I remove the BBOX portion from the Filter, then I see that
the result is filtered by PERSONS:

Request: getFeature
  handle = null
  service = WFS
  version = 1.0.0
  baseUrl = http://localhost:8080/geoserver/
  query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propertyName: [topp:STATE_NAME, topp:PERSONS], function: null, filter:
[ PERSONS BETWEEN 400000 AND 1000000 ], sortBy: null, featureVersion:
null, handle: null, srsName: null, typeName:
[{http://www.openplans.org/topp\}states])]
  maxFeatures = null
  outputFormat = GML2
  resultType = results
  traverseXlinkDepth = null
  traverseXlinkExpiry = null

Any ideas? It looks like only the topmost portion of a filter is
recognized, and anything that follows is discarded.

Thanks in advance for your help,

Alex

Shouldn't there be an ogc namespace at the 'Property'-tags (e.g. ogc:PropertyIsBetween) ?

I really am not an expert on this, just a wild guess.

- mika -

Alexander Petkov kirjoitti:

Hello:

I am having a problem with using an OGC filter with a getFeature request.

The following filter will not work as expected:

<wfs:GetFeature service="WFS" version="1.0.0"
  outputFormat="GML2"
  xmlns:topp="http://www.openplans.org/topp&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:gml="http://www.opengis.net/gml&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
  <wfs:Query typeName="topp:states">
    <ogc:PropertyName>topp:STATE_NAME</ogc:PropertyName>
    <ogc:PropertyName>topp:PERSONS</ogc:PropertyName>
    <ogc:Filter>
      <ogc:BBOX>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
           <gml:coordinates>-150,20 -72.361859,41.512517</gml:coordinates>
        </gml:Box>
      </ogc:BBOX>
<PropertyIsBetween><PropertyName>PERSONS</PropertyName><LowerBoundary><Literal>400000</Literal></LowerBoundary><UpperBoundary><Literal>1000000</Literal></UpperBoundary></PropertyIsBetween>
   </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

>From the logs I see that only the "BBOX" part for the filter gets
parsed, and the "PorpertyIsBetween" portion is ignored:

Request: getFeature
  handle = null
  service = WFS
  version = 1.0.0
  baseUrl = http://localhost:8080/geoserver/
  query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propertyName: [topp:STATE_NAME, topp:PERSONS], function: null, filter:
[ the_geom bbox POLYGON ((-150 20, -150 41.512517, -72.361859
41.512517, -72.361859 20, -150 20)) ], sortBy: null, featureVersion:
null, handle: null, srsName: null, typeName:
[{http://www.openplans.org/topp\}states])]
  maxFeatures = null
  outputFormat = GML2
  resultType = results
  traverseXlinkDepth = null
  traverseXlinkExpiry = null

However, if I remove the BBOX portion from the Filter, then I see that
the result is filtered by PERSONS:

Request: getFeature
  handle = null
  service = WFS
  version = 1.0.0
  baseUrl = http://localhost:8080/geoserver/
  query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propertyName: [topp:STATE_NAME, topp:PERSONS], function: null, filter:
[ PERSONS BETWEEN 400000 AND 1000000 ], sortBy: null, featureVersion:
null, handle: null, srsName: null, typeName:
[{http://www.openplans.org/topp\}states])]
  maxFeatures = null
  outputFormat = GML2
  resultType = results
  traverseXlinkDepth = null
  traverseXlinkExpiry = null

Any ideas? It looks like only the topmost portion of a filter is
recognized, and anything that follows is discarded.

Thanks in advance for your help,

Alex

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
  

Didn't help... If it is an issue with recognizing the namespace for
the tags, I'd think there will be an exception thrown.

Alex

On Tue, Jun 3, 2008 at 12:38 PM, Lehtonen, Mika <mika@anonymised.com> wrote:

Shouldn't there be an ogc namespace at the 'Property'-tags (e.g.
ogc:PropertyIsBetween) ?

I really am not an expert on this, just a wild guess.

- mika -

Alexander Petkov kirjoitti:

Hello:

I am having a problem with using an OGC filter with a getFeature request.

The following filter will not work as expected:

<wfs:GetFeature service="WFS" version="1.0.0"
outputFormat="GML2"
xmlns:topp="http://www.openplans.org/topp&quot;
xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.opengis.net/wfs
                     http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
<wfs:Query typeName="topp:states">
   <ogc:PropertyName>topp:STATE_NAME</ogc:PropertyName>
   <ogc:PropertyName>topp:PERSONS</ogc:PropertyName>
   <ogc:Filter>
     <ogc:BBOX>
       <ogc:PropertyName>the_geom</ogc:PropertyName>
       <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
          <gml:coordinates>-150,20 -72.361859,41.512517</gml:coordinates>
       </gml:Box>
     </ogc:BBOX>

<PropertyIsBetween><PropertyName>PERSONS</PropertyName><LowerBoundary><Literal>400000</Literal></LowerBoundary><UpperBoundary><Literal>1000000</Literal></UpperBoundary></PropertyIsBetween>
  </ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

>From the logs I see that only the "BBOX" part for the filter gets
parsed, and the "PorpertyIsBetween" portion is ignored:

Request: getFeature
       handle = null
       service = WFS
       version = 1.0.0
       baseUrl = http://localhost:8080/geoserver/
       query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propertyName: [topp:STATE_NAME, topp:PERSONS], function: null, filter:
[ the_geom bbox POLYGON ((-150 20, -150 41.512517, -72.361859
41.512517, -72.361859 20, -150 20)) ], sortBy: null, featureVersion:
null, handle: null, srsName: null, typeName:
[{http://www.openplans.org/topp\}states])]
       maxFeatures = null
       outputFormat = GML2
       resultType = results
       traverseXlinkDepth = null
       traverseXlinkExpiry = null

However, if I remove the BBOX portion from the Filter, then I see that
the result is filtered by PERSONS:

Request: getFeature
       handle = null
       service = WFS
       version = 1.0.0
       baseUrl = http://localhost:8080/geoserver/
       query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propertyName: [topp:STATE_NAME, topp:PERSONS], function: null, filter:
[ PERSONS BETWEEN 400000 AND 1000000 ], sortBy: null, featureVersion:
null, handle: null, srsName: null, typeName:
[{http://www.openplans.org/topp\}states])]
       maxFeatures = null
       outputFormat = GML2
       resultType = results
       traverseXlinkDepth = null
       traverseXlinkExpiry = null

Any ideas? It looks like only the topmost portion of a filter is
recognized, and anything that follows is discarded.

Thanks in advance for your help,

Alex

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hello,

You need an And tag around your conditions:
ogc:Filter

ogc:BBOX
ogc:PropertyNamethe_geom</ogc:PropertyName>
<gml:Box srsName=“http://www.opengis.net/gml/srs/epsg.xml#4326”>
gml:coordinates-150,20 -72.361859,41.512517</gml:coordinates>
</gml:Box>
</ogc:BBOX>

PERSONS
400000
1000000


</ogc:Filter>

Regards
Albin


Från: geoserver-users-bounces@lists.sourceforge.net [mailto:geoserver-users-bounces@lists.sourceforge.net] För Alexander Petkov
Skickat: den 3 juni 2008 20:24
Till: geoserver users
Ämne: [Geoserver-users] OGC Filter in 1.6.x

Hello:

I am having a problem with using an OGC filter with a getFeature request.

The following filter will not work as expected:

<wfs:GetFeature service=“WFS” version=“1.0.0”
outputFormat=“GML2”
xmlns:topp=“http://www.openplans.org/topp
xmlns:wfs=“http://www.opengis.net/wfs
xmlns:ogc=“http://www.opengis.net/ogc
xmlns:gml=“http://www.opengis.net/gml
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=“http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd”>
<wfs:Query typeName=“topp:states”>
ogc:PropertyNametopp:STATE_NAME</ogc:PropertyName>
ogc:PropertyNametopp:PERSONS</ogc:PropertyName>
ogc:Filter
ogc:BBOX
ogc:PropertyNamethe_geom</ogc:PropertyName>
<gml:Box srsName=“http://www.opengis.net/gml/srs/epsg.xml#4326”>
gml:coordinates-150,20 -72.361859,41.512517</gml:coordinates>
</gml:Box>
</ogc:BBOX>
PERSONS4000001000000
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

From the logs I see that only the “BBOX” part for the filter gets
parsed, and the “PorpertyIsBetween” portion is ignored:
===================================================
Request: getFeature
handle = null
service = WFS
version = 1.0.0
baseUrl = http://localhost:8080/geoserver/
query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propertyName: [topp:STATE_NAME, topp:PERSONS], function: null, filter:
[ the_geom bbox POLYGON ((-150 20, -150 41.512517, -72.361859 41.512517, -72.361859 20, -150 20)) ], sortBy: null, featureVersion:
null, handle: null, srsName: null, typeName:
[{http://www.openplans.org/topp}states])]
maxFeatures = null
outputFormat = GML2
resultType = results
traverseXlinkDepth = null
traverseXlinkExpiry = null
======================================================

However, if I remove the BBOX portion from the Filter, then I see that the result is filtered by PERSONS:

Request: getFeature
handle = null
service = WFS
version = 1.0.0
baseUrl = http://localhost:8080/geoserver/
query = [net.opengis.wfs.impl.QueryTypeImpl@anonymised.com (group: null,
propertyName: [topp:STATE_NAME, topp:PERSONS], function: null, filter:
[ PERSONS BETWEEN 400000 AND 1000000 ], sortBy: null, featureVersion:
null, handle: null, srsName: null, typeName:
[{http://www.openplans.org/topp}states])]
maxFeatures = null
outputFormat = GML2
resultType = results
traverseXlinkDepth = null
traverseXlinkExpiry = null

Any ideas? It looks like only the topmost portion of a filter is recognized, and anything that follows is discarded.

Thanks in advance for your help,

Alex


This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Much appreciated, thanks :slight_smile:

Alex

On Tue, Jun 3, 2008 at 1:11 PM, Lundmark Albin <Albin.Lundmark@anonymised.com> wrote:

Hello,
You need an And tag around your conditions:
  <ogc:Filter>
    <And>
        <ogc:BBOX>
            <ogc:PropertyName>the_geom</ogc:PropertyName>
            <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
               <gml:coordinates>-150,20
-72.361859,41.512517</gml:coordinates>
            </gml:Box>
        </ogc:BBOX>
        <PropertyIsBetween>
            <PropertyName>PERSONS</PropertyName>
            <LowerBoundary><Literal>400000</Literal></LowerBoundary>
            <UpperBoundary><Literal>1000000</Literal></UpperBoundary>
        </PropertyIsBetween>
    </And>
</ogc:Filter>

Regards
Albin

Alexander Petkov ha scritto:

Didn't help... If it is an issue with recognizing the namespace for
the tags, I'd think there will be an exception thrown.

Alex,
if you're building requests by hand I suggest you post them to the
following url:
http://host:port/geoserver/wfs?strict=true

thereby enabling schema validation of your requests.
The new XML parser in GeoServer (from 1.6.x onwards) can work in two ways:
- lenient (default): tries to eat whatever it can, ignores the parts
   that it does not know how to handle
- strict: validates the request against the xml schemas before parsing
   it.

We wanted to ship in the second mode by default, but unfortunately
we noticed that many clients around are making slightly invalid request
that can be parsed in lenient mode, but would fail due to validation
errors in strict mode.

Thus we ship in lenient mode, with the downside that you won't get
good error messages if you're making mistakes in your request.

Cheers
Andrea

On Wed, Jun 4, 2008 at 6:35 AM, Andrea Aime <aaime@anonymised.com> wrote:

Alexander Petkov ha scritto:

Didn't help... If it is an issue with recognizing the namespace for
the tags, I'd think there will be an exception thrown.

Alex,
if you're building requests by hand I suggest you post them to the
following url:
http://host:port/geoserver/wfs?strict=true

thereby enabling schema validation of your requests.
The new XML parser in GeoServer (from 1.6.x onwards) can work in two ways:
- lenient (default): tries to eat whatever it can, ignores the parts
that it does not know how to handle
- strict: validates the request against the xml schemas before parsing
it.

We wanted to ship in the second mode by default, but unfortunately
we noticed that many clients around are making slightly invalid request
that can be parsed in lenient mode, but would fail due to validation
errors in strict mode.

Thus we ship in lenient mode, with the downside that you won't get
good error messages if you're making mistakes in your request.

Cheers
Andrea

Thanks Andrea, will do.

The filter in question (ie specifying more than one criteria for a
filter) seemed to work with an earlier (1.5.x) release. With 1.6.x I
am back on track by enclosing multiple conditions with an <And> tag.

Alex