Hi Ben,

After I wrap the filter in the Filter tags with namespaces everything 
works as expected. Thanks for the detailed explanation!  Including your 
example together with some explanation in the documentation would be 
helpful for others.

Cheers,
Nhan

On 9/11/2013 11:20 AM, Ben Caradoc-Davies wrote:
> Nhan,
>
> because WFS 2.0 no longer depends on any version of GML, when 
> GeoServer is parsing your request it cannot deduce what version of GML 
> or filter you are using. One solution that works is to specify the 
> namespaces; I added an fes:Filter element as a place where I could put 
> the xmlns attributes. A strictly conformant WFS 2.0 implementation 
> *requires* these. GeoServer is permissive, but it cannot guess in this 
> case (we have gotten soft and spoiled by the hard link between WFS 
> 1.1.0 and GML 3.1.1). The separation of concerns in WFS 2.0 is better, 
> but it means users have to be a bit more pedantic.
>
> For example, I was able to pick out the second feature <sf:bugsites 
> gml:id="bugsites.2"> ("Beetle site") in the sample sf:bugsites data 
> shipped with GeoServer with:
>
> http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=sf:bugsites&filter=%3Cfes:Filter%20xmlns:fes=%27http://www.opengis.net/fes/2.0%27%20xmlns:gml=%27http://www.opengis.net/gml/3.2%27%3E%3Cfes:Not%3E%3Cfes:Disjoint%3E%3Cfes:ValueReference%3Esf:the_geom%3C/fes:ValueReference%3E%3Cgml:Polygon%20srsName=%27http://www.opengis.net/def/crs/EPSG/0/26713%27%3E%3Cgml:exterior%3E%3Cgml:LinearRing%3E%3Cgml:posList%3E590431.0%204915204.0%20590430.0%204915205.0%20590429.0%204915204.0%20590430.0%204915203.0%20590431.0%204915204.0%3C/gml:posList%3E%3C/gml:LinearRing%3E%3C/gml:exterior%3E%3C/gml:Polygon%3E%3C/fes:Disjoint%3E%3C/fes:Not%3E%3C/fes:Filter%3E
>  
>
>
> The decoded filter part is:
>
> filter=<fes:Filter xmlns:fes='http://www.opengis.net/fes/2.0' 
> xmlns:gml='http://www.opengis.net/gml/3.2'><fes:Not><fes:Disjoint><fes:ValueReference>sf:the_geom</fes:ValueReference><gml:Polygon
>  
> srsName='http://www.opengis.net/def/crs/EPSG/0/26713'><gml:exterior><gml:LinearRing><gml:posList>590431.0
>  
> 4915204.0 590430.0 4915205.0 590429.0 4915204.0 590430.0 4915203.0 
> 590431.0 
> 4915204.0</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></fes:Disjoint></fes:Not></fes:Filter>
>
> Note the two xmlns attributes on fes:Filter to ensure the namespace 
> prefixes are unambiguous.
>
> We should update the user manual to include this example.
>
> Kind regards,
> Ben.
>
> On 11/09/13 15:44, Nhan Vo wrote:
>> Hi Ben,
>>
>> Thank you for clarification. Here is the query part of the GET request:
>>
>> The query that does not work:
>> ?VERSION=2.0&SERVICE=WFS&REQUEST=GetFeature&TYPENAME=ns1:db_entries&FILTER=<Not><Disjoint><ValueReference>ns1:geometry</ValueReference><gml:Polygon
>>  
>>
>> srsName='urn:x-ogc:def:crs:EPSG:4326'><gml:exterior><gml:LinearRing><gml:posList>54.6
>>  
>>
>> 8.3 54.7 8.4 54.7 8.5 54.6
>> 8.3</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></Disjoint></Not>
>>  
>>
>>
>> This one works:
>> ?VERSION=2.0&SERVICE=WFS&REQUEST=GetFeature&TYPENAME=ns1:db_entries&FILTER=<PropertyIsEqualTo
>>  
>>
>> matchCase='false'><ValueReference>ns1:name</ValueReference><Literal>SkAllnask</Literal></PropertyIsEqualTo>
>>  
>>
>>
>> The part after &FILTER= is encoded when sent to the server.
>>
>> In the sample requests (e.g. getFeatureBetween URL), it seems that the
>> part after &FILTER= is wrapped between <Filter
>> xmlns='http://www.opengis.net/ogc'> and </Filter>. I've also tried that
>> but without luck.
>>
>> It is a nice feature that GeoServer lets one choose between permissive
>> and strict modes :-)
>>
>> Cheers,
>> Nhan
>>
>> On 9/11/2013 4:56 AM, Ben Caradoc-Davies wrote:
>>> Nhan,
>>>
>>> GeoServer is by default permissive when it comes to namespaces.
>>>
>>> Please paste the entire request GET URL into an email so we can see
>>> it. Or the query part (after "?") at least if you do not want to
>>> disclose the host.
>>>
>>> Also, note that the schemaLocation in your request is wrong: the WFS 2
>>> namespace should be followed by the WFS 2.0 schema URL, not GML 3.2:
>>>
>>> xsi:schemaLocation="http://www.opengis.net/wfs/2.0
>>> http://schemas.opengis.net/gml/3.2.1/gml.xsd";
>>>
>>> Like this (stolen from a WFS 2.0 response):
>>>
>>> xsi:schemaLocation="http://www.opengis.net/gml/3.2
>>> http://schemas.opengis.net/gml/3.2.1/gml.xsd
>>> http://www.opengis.net/wfs/2.0
>>> http://schemas.opengis.net/wfs/2.0/wfs.xsd";
>>>
>>> Kind regards,
>>> Ben.
>>>
>>> On 10/09/13 19:50, Nhan Vo wrote:
>>>> Hi list,
>>>>
>>>> I've tried the following filter in the Demo request page and it works
>>>> (even though some elements do not have namespace prefix):
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <wfs:GetFeature
>>>>        service="WFS"
>>>>        version="2.0.0"
>>>>        xmlns:wfs="http://www.opengis.net/wfs/2.0";
>>>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>>        xmlns:gml="http://www.opengis.net/gml/3.2";
>>>>        xmlns:fes="http://www.opengis.net/fes/2.0";
>>>>        xsi:schemaLocation="
>>>> http://www.opengis.net/wfs/2.0
>>>> http://schemas.opengis.net/gml/3.2.1/gml.xsd";>
>>>>        <wfs:Query typeNames="ns1:db_entries">
>>>>            <fes:Filter>
>>>>                    <Not>
>>>>                        <Disjoint>
>>>> <ValueReference>ns1:geometry</ValueReference>
>>>>                            <gml:Polygon
>>>> srsName='urn:x-ogc:def:crs:EPSG:4326'>
>>>>                                <gml:exterior>
>>>>                                    <gml:LinearRing>
>>>> <gml:posList>54.6 8.3 54.7 8.4
>>>> 54.7
>>>> 8.5 54.6 8.3</gml:posList>
>>>>                                    </gml:LinearRing>
>>>>                                </gml:exterior>
>>>>                            </gml:Polygon>
>>>>                        </Disjoint>
>>>>                    </Not>
>>>>            </fes:Filter>
>>>>         </wfs:Query>
>>>> </wfs:GetFeature>
>>>>
>>>> But when I copy the portion:
>>>>                    <Not>
>>>>                        <Disjoint>
>>>> <ValueReference>ns1:geometry</ValueReference>
>>>>                            <gml:Polygon
>>>> srsName='urn:x-ogc:def:crs:EPSG:4326'>
>>>>                                <gml:exterior>
>>>>                                    <gml:LinearRing>
>>>> <gml:posList>54.6 8.3 54.7 8.4
>>>> 54.7
>>>> 8.5 54.6 8.3</gml:posList>
>>>>                                    </gml:LinearRing>
>>>>                                </gml:exterior>
>>>>                            </gml:Polygon>
>>>>                        </Disjoint>
>>>>                    </Not>
>>>> and use it (after encoded) in a request URL after &FILTER=, it does 
>>>> not
>>>> work, and I receive the error message:
>>>>
>>>> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>>>> Index: 0, Size: 0
>>>>
>>>> I've done the same thing in URLs with other filter 2.0 elements like
>>>> PropertyIsLike and PropertyIsEqualTo and they work for me. Could 
>>>> someone
>>>> give me a hint? Thanks!
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>>  
>>>>
>>>>
>>>> How ServiceNow helps IT people transform IT departments:
>>>> 1. Consolidate legacy IT systems to a single system of record for IT
>>>> 2. Standardize and globalize service processes across IT
>>>> 3. Implement zero-touch automation to replace manual, redundant tasks
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
>>>>  
>>>>
>>>>
>>>> _______________________________________________
>>>> Geoserver-users mailing list
>>>> Geoserver-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>>  
>>
>> How ServiceNow helps IT people transform IT departments:
>> 1. Consolidate legacy IT systems to a single system of record for IT
>> 2. Standardize and globalize service processes across IT
>> 3. Implement zero-touch automation to replace manual, redundant tasks
>> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk 
>>
>> _______________________________________________
>> Geoserver-users mailing list
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to