[Geoserver-users] Filters in WFS Get request

okay, I took another look at your filter and the reason its not working
is because you are using the "ogc:" and "gml:" namespaces without
defining them in your XML fragment.

Use this:

http://localhost:8080/geoserver/wfs?&version=1.0.0&request=GetFeature&service=WFS&typename=gcp:accession&filter=<ogc:Filter
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"><ogc:And><ogc:BBOX><ogc:PropertyName>LocationGML</ogc:PropertyName><gml:Box
srsName="http://www.opengis.net/gml/srs/epsg.xml%234326"><gml:coordinates>\-5\.416259765625,37\.77071473849608
27.147216796875,47.08508535995383</gml:coordinates></gml:Box></ogc:BBOX><ogc:PropertyIsEqualTo><ogc:PropertyName>Genus</ogc:PropertyName><ogc:Literal>Vicia</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>

http://localhost:8080/geoserver/wfs?&version=1.0.0&request=GetFeature&service=WFS&typename=gcp:accession&filter=<ogc:Filter%20xmlns:gml="http://www.opengis.net/gml"%20xmlns:ogc="http://www.opengis.net/ogc"><ogc:And><ogc:BBOX><ogc:PropertyName>LocationGML</ogc:PropertyName><gml:Box%20srsName="http://www.opengis.net/gml/srs/epsg.xml%234326"><gml:coordinates>-5.416259765625,37.77071473849608%2027.147216796875,47.08508535995383</gml:coordinates></gml:Box></ogc:BBOX><ogc:PropertyIsEqualTo><ogc:PropertyName>Genus</ogc:PropertyName><ogc:Literal>Vicia</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>

<ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:And>
<ogc:BBOX>
<ogc:PropertyName>LocationGML</ogc:PropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
<gml:coordinates>-5.416259765625,37.77071473849608
27.147216796875,47.08508535995383</gml:coordinates>
</gml:Box>
</ogc:BBOX>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>Genus</ogc:PropertyName>
<ogc:Literal>Vicia</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>

Notice that I added:

xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;

to the <ogc:Filter> element.

dave

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

Cool!

I did not realize of that. The namespaces where declared in below the filter in the full XML request and therefore I thought it was not necessary to use them only when specifying the filter...

How did you debug that? Just for curiosity.

Thanks.

Javier.

On 03/12/2005, at 11:53, dblasby@anonymised.com wrote:

okay, I took another look at your filter and the reason its not working
is because you are using the "ogc:" and "gml:" namespaces without
defining them in your XML fragment.

Use this:

http://localhost:8080/geoserver/wfs?&version=1.0.0&request=GetFeature&service=WFS&typename=gcp:accession&filter=&lt;ogc:Filter
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;&lt;ogc:And&gt;&lt;ogc:BBOX&gt;&lt;ogc:PropertyName&gt;LocationGML&lt;/ogc:PropertyName&gt;&lt;gml:Box
srsName="http://www.opengis.net/gml/srs/epsg.xml%234326&quot;&gt;&lt;gml:coordinates&gt;\-5\.416259765625,37\.77071473849608
27.147216796875,47.08508535995383</gml:coordinates></gml:Box></ogc:BBOX><ogc:PropertyIsEqualTo><ogc:PropertyName>Genus</ogc:PropertyName><ogc:Literal>Vicia</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>

http://localhost:8080/geoserver/wfs?&version=1.0.0&request=GetFeature&service=WFS&typename=gcp:accession&filter=<ogc:Filter%20xmlns:gml="http://www.opengis.net/gml"%20xmlns:ogc="http://www.opengis.net/ogc"><ogc:And><ogc:BBOX><ogc:PropertyName>LocationGML</ogc:PropertyName><gml:Box%20srsName="http://www.opengis.net/gml/srs/epsg.xml%234326"><gml:coordinates>-5.416259765625,37.77071473849608%2027.147216796875,47.08508535995383</gml:coordinates></gml:Box></ogc:BBOX><ogc:PropertyIsEqualTo><ogc:PropertyName>Genus</ogc:PropertyName><ogc:Literal>Vicia</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>

<ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:And>
<ogc:BBOX>
<ogc:PropertyName>LocationGML</ogc:PropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
<gml:coordinates>-5.416259765625,37.77071473849608
27.147216796875,47.08508535995383</gml:coordinates>
</gml:Box>
</ogc:BBOX>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>Genus</ogc:PropertyName>
<ogc:Literal>Vicia</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>

Notice that I added:

xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;

to the <ogc:Filter> element.

dave

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

Yep!

And by the way...
Is this URL encode part of the WFS standard? Is in the standard specified how you have to encode the filter in a GET request? If so it also specifies this requirement of namespaces and so on? Is there any other encoding possible that is not directly the XML encoded in a URL? I mean through parameters.

I am making so many questions because we are developing a quite similar protocol to WFS and we have to deal with same issues...

Thanks.

Javier.

On 03/12/2005, at 11:53, dblasby@anonymised.com wrote:

okay, I took another look at your filter and the reason its not working
is because you are using the "ogc:" and "gml:" namespaces without
defining them in your XML fragment.

Use this:

http://localhost:8080/geoserver/wfs?&version=1.0.0&request=GetFeature&service=WFS&typename=gcp:accession&filter=&lt;ogc:Filter
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;&lt;ogc:And&gt;&lt;ogc:BBOX&gt;&lt;ogc:PropertyName&gt;LocationGML&lt;/ogc:PropertyName&gt;&lt;gml:Box
srsName="http://www.opengis.net/gml/srs/epsg.xml%234326&quot;&gt;&lt;gml:coordinates&gt;\-5\.416259765625,37\.77071473849608
27.147216796875,47.08508535995383</gml:coordinates></gml:Box></ogc:BBOX><ogc:PropertyIsEqualTo><ogc:PropertyName>Genus</ogc:PropertyName><ogc:Literal>Vicia</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>

http://localhost:8080/geoserver/wfs?&version=1.0.0&request=GetFeature&service=WFS&typename=gcp:accession&filter=<ogc:Filter%20xmlns:gml="http://www.opengis.net/gml"%20xmlns:ogc="http://www.opengis.net/ogc"><ogc:And><ogc:BBOX><ogc:PropertyName>LocationGML</ogc:PropertyName><gml:Box%20srsName="http://www.opengis.net/gml/srs/epsg.xml%234326"><gml:coordinates>-5.416259765625,37.77071473849608%2027.147216796875,47.08508535995383</gml:coordinates></gml:Box></ogc:BBOX><ogc:PropertyIsEqualTo><ogc:PropertyName>Genus</ogc:PropertyName><ogc:Literal>Vicia</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>

<ogc:Filter xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:And>
<ogc:BBOX>
<ogc:PropertyName>LocationGML</ogc:PropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
<gml:coordinates>-5.416259765625,37.77071473849608
27.147216796875,47.08508535995383</gml:coordinates>
</gml:Box>
</ogc:BBOX>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>Genus</ogc:PropertyName>
<ogc:Literal>Vicia</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>

Notice that I added:

xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;

to the <ogc:Filter> element.

dave

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/