[Geoserver-devel] Questions about WFS functions

Hi Sándor,

Comments inline.

Sándor Farkas wrote:

Hi Justin,

I've tried your function example in my Geoserver 1.5 demo, but this
doesn't work

<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:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.opengis.net/wfs
<http://www.opengis.net/wfs&gt;
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
   <wfs:Query typeName="states">
<ogc:Filter>
    <ogc:PropertyIsEqualTo>
      <ogc:Function name="strStartsWith">
         <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
         <ogc:Literal>Cali</ogc:Literal>
      </ogc:Function>
      <ogc:Literal>true</ogc:Literal>
    </ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

if I cut function and complete the state name "California" I get the
right response.

   <wfs:Query typeName="states">
<ogc:Filter>
    <ogc:PropertyIsEqualTo>
         <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
         <ogc:Literal>California</ogc:Literal>
    </ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

What is wrong with "strStartsWith" function?

There is a bug that prevents boolean properties from being evaluated
properly. The bug has been fixed on geotools trunk, so the next release
of GeoServer against trunk should have this fixed.

I've got another question too. I have my data in postgis database and I
would like to construct a WFS query / filter with subselect.

eg. I've loaded States into postgis as a test, there I can say

select * from states2 where touches(the_geom, (select the_geom from
states2 where state_name = 'California'));

This returns me Arizona, Oregon and Nevada records. How can I constuct
this filter through WFS?

Unfortunately there is no notion of sub queries in wfs. I cant really
think of any other way to do this with a single query either. Anyone
else have any ideas?

Thank you in advance,

Sándor

-Justin

!DSPAM:1004,45ab550d24791429667743!

--
Justin Deoliveira
jdeolive@anonymised.com
The Open Planning Project
http://topp.openplans.org

Justin Deoliveira ha scritto:

Hi Sándor,

I've got another question too. I have my data in postgis database and I
would like to construct a WFS query / filter with subselect.

eg. I've loaded States into postgis as a test, there I can say

select * from states2 where touches(the_geom, (select the_geom from
states2 where state_name = 'California'));

This returns me Arizona, Oregon and Nevada records. How can I constuct
this filter through WFS?

Unfortunately there is no notion of sub queries in wfs. I cant really
think of any other way to do this with a single query either. Anyone
else have any ideas?

Hum, the above I think could be expressed as well as:

create view touch_states as
select s1.*, s2.state_name as touching_state_name
from states2 s1, states2 s2
where touches(s1.the_geom, s2.the_geom)

and

select *
from touch_states
where touching_state_name = 'California'

So theoretically you could create the view, register its
geometric columns, and issue the simple query against the
touch_states feature type.

Unfortuantely WFS has no notion of join and subqueries, so
there's really no way to handle this dinamically. It's a matter
of configuration, today we suggest with a view, tomorrow
maybe we'll be able to work at the feature type configuration
layer, but not at the WFS level. The WFS GetFeature sintax is
simply not expressive enough.

Cheers
Andrea

Hi Andrea,

thank you very much, I’ve tried it out it is perfect.

Sándor

On 1/15/07, Andrea Aime < aaime@…13…> wrote:

Justin Deoliveira ha scritto:

Hi Sándor,

I’ve got another question too. I have my data in postgis database and I
would like to construct a WFS query / filter with subselect.

eg. I’ve loaded States into postgis as a test, there I can say

select * from states2 where touches(the_geom, (select the_geom from
states2 where state_name = ‘California’));

This returns me Arizona, Oregon and Nevada records. How can I constuct
this filter through WFS?

Unfortunately there is no notion of sub queries in wfs. I cant really
think of any other way to do this with a single query either. Anyone
else have any ideas?

Hum, the above I think could be expressed as well as:

create view touch_states as
select s1.*, s2.state_name as touching_state_name
from states2 s1, states2 s2
where touches(s1.the_geom, s2.the_geom )

and

select *
from touch_states
where touching_state_name = ‘California’

So theoretically you could create the view, register its
geometric columns, and issue the simple query against the
touch_states feature type.

Unfortuantely WFS has no notion of join and subqueries, so
there’s really no way to handle this dinamically. It’s a matter
of configuration, today we suggest with a view, tomorrow
maybe we’ll be able to work at the feature type configuration
layer, but not at the WFS level. The WFS GetFeature sintax is
simply not expressive enough.

Cheers
Andrea