[Geoserver-users] Exception thrown on WFS query using "Between" filter

Hi all,

I'm passing the following query to the WFS:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot; version="1.1.0"
service="WFS" xmlns:aa="http://myns/&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<wfs:Query typeName="aa:feature_type">
  <Filter>
   <Between>
    <PropertyName>error</PropertyName>
    <LowerBoundary>0</LowerBoundary>
    <UpperBoundary>10000</UpperBoundary>
   </Between>
  </Filter>
</wfs:Query>
</wfs:GetFeature>

When I try and do this I get an exception:

<ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>java.util.NoSuchElementException: Could not
aquire feature:org.geotools.data.DataSourceException: Error Performing
SQL query: SELECT &amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;apos;XDR&amp
;apos;),&amp;apos;base64&amp;apos;), &amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot; WHERE LIMIT
1000000
Could not aquire feature:org.geotools.data.DataSourceException: Error
Performing SQL query: SELECT &amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;apos;XDR&amp
;apos;),&amp;apos;base64&amp;apos;), &amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot; WHERE LIMIT
1000000
Error Performing SQL query: SELECT &amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;apos;XDR&amp
;apos;),&amp;apos;base64&amp;apos;), &amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot; WHERE LIMIT
1000000
ERROR: syntax error at or near
&amp;quot;LIMIT&amp;quot;</ows:ExceptionText>
  </ows:Exception>

On inspecting the SQL in the exception report I can see that the WHERE
clause is left empty. Surely it should be:

SELECT "id", encode(asBinary(force_2d("location"),'XDR'),'base64'),
"error" FROM "public"."feature_type" WHERE "error" BETWEEN 0 AND 10000
LIMIT 1000000

I can get around it with the obvious:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot; version="1.1.0"
service="WFS" xmlns:aa="http://myns/&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<wfs:Query typeName="aa:feature_type">
  <Filter>
   <And>
    <PropertyIsGreaterThan>
     <PropertyName>error</PropertyName>
     <Literal>0</Literal>
    </PropertyIsGreaterThan>
    <PropertyIsLessThan>
     <PropertyName>error</PropertyName>
     <Literal>10000</Literal>
    </PropertyIsLessThan>
   </And>
  </Filter>
</wfs:Query>
</wfs:GetFeature>

Is this a known bug?

Many thanks,

Mark Lidstone
Tel: +44 (0)23 80232222; Fax: +44 (0)23 80232891

BMT Cordah Ltd
Grove House
7 Ocean Way
Ocean Village
Southampton
SO14 3TJ

BMT Cordah Ltd.
A member of the BMT group of companies
Registered Office: Investment House, 6 Union Row, Aberdeen AB10 1DQ
Registered in Scotland No. 163413
http://www.bmtcordah.com/
http://www.bmt.org/

The contents of this e-mail and any attachments are intended only for the use of the e-mail addressee(s) shown. If you are not that person, or one of those persons, you are not allowed to take any action based upon it or to copy it, forward, distribute or disclose the contents of it and you should please delete it from your system. BMT Cordah Limited does not accept liability for any errors or omissions in the context of this e-mail or its attachments, which arise as a result of Internet transmission, nor accept liability for statements which are those of the author and not clearly made on behalf of BMT Cordah Limited.

Hi,

I had this document an hand:
    Date: 3 May 2005
    Reference number of this OpenGIS® project document: OGC 04-094
    Version: 1.1.0

It contains this example:
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>RoadL_1M/segment/designation</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>SEG_A60</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>SEG_A69</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter

Perhaps this is the way the filter should be used?

-Jukka Rahkonen-

-----Alkuperäinen viesti-----
Lähettäjä: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net]
Puolesta Mark Lidstone
Lähetetty: 13. elokuuta 2008 10:59
Vastaanottaja: geoserver-users@lists.sourceforge.net
Aihe: [Geoserver-users] Exception thrown on WFS query using
"Between"filter

Hi all,

I'm passing the following query to the WFS:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot; version="1.1.0"
service="WFS" xmlns:aa="http://myns/&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<wfs:Query typeName="aa:feature_type">
  <Filter>
   <Between>
    <PropertyName>error</PropertyName>
    <LowerBoundary>0</LowerBoundary>
    <UpperBoundary>10000</UpperBoundary>
   </Between>
  </Filter>
</wfs:Query>
</wfs:GetFeature>

When I try and do this I get an exception:

<ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>java.util.NoSuchElementException:
Could not aquire
feature:org.geotools.data.DataSourceException: Error
Performing SQL query: SELECT &amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;ap
os;XDR&amp
;apos;),&amp;apos;base64&amp;apos;),
&amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot;
WHERE LIMIT 1000000 Could not aquire
feature:org.geotools.data.DataSourceException: Error
Performing SQL query: SELECT &amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;ap
os;XDR&amp
;apos;),&amp;apos;base64&amp;apos;),
&amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot;
WHERE LIMIT 1000000 Error Performing SQL query: SELECT
&amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;ap
os;XDR&amp
;apos;),&amp;apos;base64&amp;apos;),
&amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot;
WHERE LIMIT 1000000
ERROR: syntax error at or near
&amp;quot;LIMIT&amp;quot;</ows:ExceptionText>
  </ows:Exception>

On inspecting the SQL in the exception report I can see that
the WHERE clause is left empty. Surely it should be:

SELECT "id", encode(asBinary(force_2d("location"),'XDR'),'base64'),
"error" FROM "public"."feature_type" WHERE "error" BETWEEN 0
AND 10000 LIMIT 1000000

I can get around it with the obvious:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot; version="1.1.0"
service="WFS" xmlns:aa="http://myns/&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<wfs:Query typeName="aa:feature_type">
  <Filter>
   <And>
    <PropertyIsGreaterThan>
     <PropertyName>error</PropertyName>
     <Literal>0</Literal>
    </PropertyIsGreaterThan>
    <PropertyIsLessThan>
     <PropertyName>error</PropertyName>
     <Literal>10000</Literal>
    </PropertyIsLessThan>
   </And>
  </Filter>
</wfs:Query>
</wfs:GetFeature>

Is this a known bug?

Many thanks,

Mark Lidstone
Tel: +44 (0)23 80232222; Fax: +44 (0)23 80232891

BMT Cordah Ltd
Grove House
7 Ocean Way
Ocean Village
Southampton
SO14 3TJ

BMT Cordah Ltd.
A member of the BMT group of companies
Registered Office: Investment House, 6 Union Row, Aberdeen AB10 1DQ
Registered in Scotland No. 163413
http://www.bmtcordah.com/
http://www.bmt.org/

The contents of this e-mail and any attachments are intended
only for the use of the e-mail addressee(s) shown. If you are
not that person, or one of those persons, you are not allowed
to take any action based upon it or to copy it, forward,
distribute or disclose the contents of it and you should
please delete it from your system. BMT Cordah Limited does
not accept liability for any errors or omissions in the
context of this e-mail or its attachments, which arise as a
result of Internet transmission, nor accept liability for
statements which are those of the author and not clearly made
on behalf of BMT Cordah Limited.

--------------------------------------------------------------
-----------
This SF.Net email is sponsored by the Moblin Your Move
Developer's challenge
Build the coolest Linux based applications with Moblin SDK &
win great prizes
Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

/me slaps his forehead

Sorry, my mistake. You're absolutely right.

Sorry again,

Mark Lidstone
Tel: +44 (0)23 80232222; Fax: +44 (0)23 80232891

BMT Cordah Ltd
Grove House
7 Ocean Way
Ocean Village
Southampton
SO14 3TJ

-----Original Message-----
From: Rahkonen Jukka [mailto:Jukka.Rahkonen@anonymised.com]
Sent: 13 August 2008 09:49
To: Mark Lidstone; geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Exception thrown on WFS query using "Between"filter

Hi,

I had this document an hand:
    Date: 3 May 2005
    Reference number of this OpenGIS® project document: OGC 04-094
    Version: 1.1.0

It contains this example:
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>RoadL_1M/segment/designation</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>SEG_A60</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>SEG_A69</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter

Perhaps this is the way the filter should be used?

-Jukka Rahkonen-

-----Alkuperäinen viesti-----
Lähettäjä: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net]
Puolesta Mark Lidstone
Lähetetty: 13. elokuuta 2008 10:59
Vastaanottaja: geoserver-users@lists.sourceforge.net
Aihe: [Geoserver-users] Exception thrown on WFS query using
"Between"filter

Hi all,

I'm passing the following query to the WFS:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot; version="1.1.0"
service="WFS" xmlns:aa="http://myns/&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<wfs:Query typeName="aa:feature_type">
  <Filter>
   <Between>
    <PropertyName>error</PropertyName>
    <LowerBoundary>0</LowerBoundary>
    <UpperBoundary>10000</UpperBoundary>
   </Between>
  </Filter>
</wfs:Query>
</wfs:GetFeature>

When I try and do this I get an exception:

<ows:Exception exceptionCode="NoApplicableCode">
    <ows:ExceptionText>java.util.NoSuchElementException:
Could not aquire
feature:org.geotools.data.DataSourceException: Error Performing SQL
query: SELECT &amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;ap
os;XDR&amp
;apos;),&amp;apos;base64&amp;apos;),
&amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot;
WHERE LIMIT 1000000 Could not aquire
feature:org.geotools.data.DataSourceException: Error Performing SQL
query: SELECT &amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;ap
os;XDR&amp
;apos;),&amp;apos;base64&amp;apos;),
&amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot;
WHERE LIMIT 1000000 Error Performing SQL query: SELECT
&amp;quot;id&amp;quot;,
encode(asBinary(force_2d(&amp;quot;location&amp;quot;),&amp;ap
os;XDR&amp
;apos;),&amp;apos;base64&amp;apos;),
&amp;quot;error&amp;quot; FROM
&amp;quot;public&amp;quot;.&amp;quot;bathing_area&amp;quot;
WHERE LIMIT 1000000
ERROR: syntax error at or near
&amp;quot;LIMIT&amp;quot;</ows:ExceptionText>
  </ows:Exception>

On inspecting the SQL in the exception report I can see that the WHERE
clause is left empty. Surely it should be:

SELECT "id", encode(asBinary(force_2d("location"),'XDR'),'base64'),
"error" FROM "public"."feature_type" WHERE "error" BETWEEN 0 AND 10000
LIMIT 1000000

I can get around it with the obvious:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot; version="1.1.0"
service="WFS" xmlns:aa="http://myns/&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<wfs:Query typeName="aa:feature_type">
  <Filter>
   <And>
    <PropertyIsGreaterThan>
     <PropertyName>error</PropertyName>
     <Literal>0</Literal>
    </PropertyIsGreaterThan>
    <PropertyIsLessThan>
     <PropertyName>error</PropertyName>
     <Literal>10000</Literal>
    </PropertyIsLessThan>
   </And>
  </Filter>
</wfs:Query>
</wfs:GetFeature>

Is this a known bug?

Many thanks,

Mark Lidstone
Tel: +44 (0)23 80232222; Fax: +44 (0)23 80232891

BMT Cordah Ltd
Grove House
7 Ocean Way
Ocean Village
Southampton
SO14 3TJ

BMT Cordah Ltd.
A member of the BMT group of companies Registered Office: Investment
House, 6 Union Row, Aberdeen AB10 1DQ Registered in Scotland No.
163413 http://www.bmtcordah.com/ http://www.bmt.org/

The contents of this e-mail and any attachments are intended only for
the use of the e-mail addressee(s) shown. If you are not that person,
or one of those persons, you are not allowed to take any action based
upon it or to copy it, forward, distribute or disclose the contents of
it and you should please delete it from your system. BMT Cordah
Limited does not accept liability for any errors or omissions in the
context of this e-mail or its attachments, which arise as a result of
Internet transmission, nor accept liability for statements which are
those of the author and not clearly made on behalf of BMT Cordah
Limited.

--------------------------------------------------------------
-----------
This SF.Net email is sponsored by the Moblin Your Move
Developer's challenge
Build the coolest Linux based applications with Moblin SDK &
win great prizes
Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

BMT Cordah Ltd.
A member of the BMT group of companies
Registered Office: Investment House, 6 Union Row, Aberdeen AB10 1DQ
Registered in Scotland No. 163413
http://www.bmtcordah.com/
http://www.bmt.org/

The contents of this e-mail and any attachments are intended only for the use of the e-mail addressee(s) shown. If you are not that person, or one of those persons, you are not allowed to take any action based upon it or to copy it, forward, distribute or disclose the contents of it and you should please delete it from your system. BMT Cordah Limited does not accept liability for any errors or omissions in the context of this e-mail or its attachments, which arise as a result of Internet transmission, nor accept liability for statements which are those of the author and not clearly made on behalf of BMT Cordah Limited.