[Geoserver-users] spatial filter using gml:Polygon / gml:LinearRing crashes

Hi, I’m having problems using spatial filter with a polygon. Example request below:

I’ve tried with various layers with different geometry type but getting the same error. Is this spatial filter type known to work?

The layers are in a PostGIS store (newest version of postgresql/postgis installed).

<wfs:GetFeature xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:wfs=“http://www.opengis.net/wfs
xmlns:ogc=“http://www.opengis.net/ogc
service=“WFS”
version=“1.1.0”
xsi:schemaLocation=“http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd”>
<wfs:Query typeName=“sydvedbs:FAST_PKT_PDA”>
ogc:Filter
<ogc:Within xmlns:gml=“http://www.opengis.net/gml”>
gml:Polygon
gml:outerBoundaryIs
gml:LinearRing
gml:coordinates1250010,6399990 1399990,6399990 1399990,6250010 1250010,6250010 1250010,6399990 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

This causes a java.lang.NullPointerException

With trace:
at org.geotools.filter.visitor.DuplicatingFilterVisitor.visit(DuplicatingFilterVisitor.java:280)
at org.geotools.filter.spatial.WithinImpl.accept(WithinImpl.java:54)
at org.geoserver.wfs.WFSReprojectionUtil.applyDefaultCRS(WFSReprojectionUtil.java:78)
at org.geoserver.wfs.WFSReprojectionUtil.normalizeFilterCRS(WFSReprojectionUtil.java:105)
at org.geoserver.wfs.GetFeature.toDataQuery(GetFeature.java:400)
at org.geoserver.wfs.GetFeature.run(GetFeature.java:254)
at org.geoserver.wfs.DefaultWebFeatureService.getFeature(DefaultWebFeatureService.java:108)
at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

The log report just above the exception is:
2008-05-16 18:07:58,582 TRACE [geotools.xml] - startElement(http://www.opengis.net/wfs,GetFeature,wfs:GetFeature
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - returning cached schema for http://www.opengis.net/wfs
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - schema specified by parser configuration not found, supplementing…
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - returning cached schema for http://www.opengis.net/wfs
2008-05-16 18:07:58,582 TRACE [geotools.xml] - startElement(http://www.opengis.net/wfs,Query,wfs:Query
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(http://www.opengis.net/ogc,Filter,ogc:Filter
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(http://www.opengis.net/ogc,Within,ogc:Within
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(http://www.opengis.net/gml,Polygon,gml:Polygon
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(http://www.opengis.net/gml,outerBoundaryIs,gml:outerBoundaryIs
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(http://www.opengis.net/gml,LinearRing,gml:LinearRing
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(http://www.opengis.net/gml,coordinates,gml:coordinates
2008-05-16 18:07:58,598 DEBUG [data.postgis] - get Feature source called on FAST_PKT_PDA
2008-05-16 18:07:58,598 DEBUG [data.postgis] - returning pg feature locking
2008-05-16 18:07:58,598 WARN [geoserver.ows] -

Hi,

All I can say is that the following WFS 1.0.0 request works with Geoserver 1.6.2 against PostGIS. You seem to use
WFS 1.1.0, perhaps it makes some difference.

-Jukka Rahkonen-

<?xml version="1.0" encoding="ISO-8859-1"?>
<wfs:GetFeature xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:gml="http://www.opengis.net/gml&quot; xmlns:wfs="http://www.opengis.net/wfs&quot; service="WFS" version="1.0.0" maxFeatures="1000" outputFormat="GML2">
<wfs:Query xmlns:topp="http://www.openplans.org/topp&quot; srsName="EPSG:2393" typeName="topp:OSM_viivat">
<ogc:Filter>
<ogc:Within xmlns:gml='http://www.opengis.net/gml’ >
<ogc:PropertyName xmlns:topp="http://www.openplans.org/topp&quot;&gt;
topp:way</ogc:PropertyName>
<gml:Polygon srsName="EPSG:2393">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates cs="," decimal="." ts=" ">
3320976.378854669,6801408.691252723 3292394.496252066,6833166.338588948 3378140.1440598746,6864923.985925174 3384491.6735271197,6807760.220719968 3320976.378854669,6801408.691252723</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

-----Alkuperäinen viesti-----
Lähettäjä: geoserver-users-bounces@lists.sourceforge.net puolesta: Björn Harrtell
Lähetetty: pe 16.5.2008 20:51
Vastaanottaja: geoserver-users@lists.sourceforge.net
Aihe: [Geoserver-users] spatial filter using gml:Polygon / gml:LinearRingcrashes

Hi, I'm having problems using spatial filter with a polygon. Example request
below:

I've tried with various layers with different geometry type but getting the
same error. Is this spatial filter type known to work?

The layers are in a PostGIS store (newest version of postgresql/postgis
installed).

<wfs:GetFeature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
                xmlns:wfs="http://www.opengis.net/wfs&quot;
                xmlns:ogc="http://www.opengis.net/ogc&quot;
                service="WFS"
                version="1.1.0"
                xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd&quot;&gt;
   <wfs:Query typeName="sydvedbs:FAST_PKT_PDA">
      <ogc:Filter>
         <ogc:Within xmlns:gml="http://www.opengis.net/gml&quot;&gt;
            <gml:Polygon>
               <gml:outerBoundaryIs>
                  <gml:LinearRing>
                     <gml:coordinates>1250010,6399990 1399990,6399990
1399990,6250010 1250010,6250010 1250010,6399990 </gml:coordinates>
                  </gml:LinearRing>
               </gml:outerBoundaryIs>
            </gml:Polygon>
         </ogc:Within>
      </ogc:Filter>
   </wfs:Query>
</wfs:GetFeature>

This causes a java.lang.NullPointerException

With trace:
    at
org.geotools.filter.visitor.DuplicatingFilterVisitor.visit(DuplicatingFilterVisitor.java:280)
    at org.geotools.filter.spatial.WithinImpl.accept(WithinImpl.java:54)
    at
org.geoserver.wfs.WFSReprojectionUtil.applyDefaultCRS(WFSReprojectionUtil.java:78)
    at
org.geoserver.wfs.WFSReprojectionUtil.normalizeFilterCRS(WFSReprojectionUtil.java:105)
    at org.geoserver.wfs.GetFeature.toDataQuery(GetFeature.java:400)
    at org.geoserver.wfs.GetFeature.run(GetFeature.java:254)
    at
org.geoserver.wfs.DefaultWebFeatureService.getFeature(DefaultWebFeatureService.java:108)
    at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)

The log report just above the exception is:
2008-05-16 18:07:58,582 TRACE [geotools.xml] - startElement(
http://www.opengis.net/wfs,GetFeature,wfs:GetFeature
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - returning cached schema for
http://www.opengis.net/wfs
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - schema specified by parser
configuration not found, supplementing...
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - returning cached schema for
http://www.opengis.net/wfs
2008-05-16 18:07:58,582 TRACE [geotools.xml] - startElement(
http://www.opengis.net/wfs,Query,wfs:Query
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/ogc,Filter,ogc:Filter
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/ogc,Within,ogc:Within
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/gml,Polygon,gml:Polygon
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/gml,outerBoundaryIs,gml:outerBoundaryIs
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/gml,LinearRing,gml:LinearRing
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/gml,coordinates,gml:coordinates
2008-05-16 18:07:58,598 DEBUG [data.postgis] - get Feature source called on
FAST_PKT_PDA
2008-05-16 18:07:58,598 DEBUG [data.postgis] - returning pg feature locking
2008-05-16 18:07:58,598 WARN [geoserver.ows] -

I’ve tried with WFS 1.0.0 but get the same error :frowning: I’ve also tried with including propertyname of the geometry field as in your request with no success.

/Björn

On Sat, May 17, 2008 at 2:09 AM, Rahkonen Jukka <Jukka.Rahkonen@…486…> wrote:

Hi,

All I can say is that the following WFS 1.0.0 request works with Geoserver 1.6.2 against PostGIS. You seem to use
WFS 1.1.0, perhaps it makes some difference.

-Jukka Rahkonen-

<?xml version="1.0" encoding="ISO-8859-1"?>

<wfs:GetFeature xmlns:ogc=“http://www.opengis.net/ogc” xmlns:gml=“http://www.opengis.net/gml” xmlns:wfs=“http://www.opengis.net/wfs” service=“WFS” version=“1.0.0” maxFeatures=“1000” outputFormat=“GML2”>
<wfs:Query xmlns:topp=“http://www.openplans.org/topp” srsName=“EPSG:2393” typeName=“topp:OSM_viivat”>
ogc:Filter
<ogc:Within xmlns:gml=‘http://www.opengis.net/gml’ >
<ogc:PropertyName xmlns:topp=“http://www.openplans.org/topp”>
topp:way</ogc:PropertyName>
<gml:Polygon srsName=“EPSG:2393”>
gml:outerBoundaryIs
gml:LinearRing
<gml:coordinates cs=“,” decimal=“.” ts=" ">
3320976.378854669,6801408.691252723 3292394.496252066,6833166.338588948 3378140.1440598746,6864923.985925174 3384491.6735271197,6807760.220719968 3320976.378854669,6801408.691252723</gml:coordinates>

</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

-----Alkuperäinen viesti-----
Lähettäjä: geoserver-users-bounces@lists.sourceforge.net puolesta: Björn Harrtell
Lähetetty: pe 16.5.2008 20:51
Vastaanottaja: geoserver-users@lists.sourceforge.net
Aihe: [Geoserver-users] spatial filter using gml:Polygon / gml:LinearRingcrashes

Hi, I’m having problems using spatial filter with a polygon. Example request
below:

I’ve tried with various layers with different geometry type but getting the
same error. Is this spatial filter type known to work?

The layers are in a PostGIS store (newest version of postgresql/postgis
installed).

<wfs:GetFeature xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:wfs=“http://www.opengis.net/wfs
xmlns:ogc=“http://www.opengis.net/ogc
service=“WFS”
version=“1.1.0”
xsi:schemaLocation=“http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd”>
<wfs:Query typeName=“sydvedbs:FAST_PKT_PDA”>
ogc:Filter
<ogc:Within xmlns:gml=“http://www.opengis.net/gml”>
gml:Polygon
gml:outerBoundaryIs
gml:LinearRing
gml:coordinates1250010,6399990 1399990,6399990
1399990,6250010 1250010,6250010 1250010,6399990 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

This causes a java.lang.NullPointerException

With trace:
at
org.geotools.filter.visitor.DuplicatingFilterVisitor.visit(DuplicatingFilterVisitor.java:280)
at org.geotools.filter.spatial.WithinImpl.accept(WithinImpl.java:54)
at
org.geoserver.wfs.WFSReprojectionUtil.applyDefaultCRS(WFSReprojectionUtil.java:78)
at
org.geoserver.wfs.WFSReprojectionUtil.normalizeFilterCRS(WFSReprojectionUtil.java:105)
at org.geoserver.wfs.GetFeature.toDataQuery(GetFeature.java:400)
at org.geoserver.wfs.GetFeature.run(GetFeature.java:254)
at
org.geoserver.wfs.DefaultWebFeatureService.getFeature(DefaultWebFeatureService.java:108)
at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

The log report just above the exception is:
2008-05-16 18:07:58,582 TRACE [geotools.xml] - startElement(
http://www.opengis.net/wfs,GetFeature,wfs:GetFeature
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - returning cached schema for
http://www.opengis.net/wfs
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - schema specified by parser
configuration not found, supplementing…
2008-05-16 18:07:58,582 DEBUG [geotools.xml] - returning cached schema for
http://www.opengis.net/wfs
2008-05-16 18:07:58,582 TRACE [geotools.xml] - startElement(
http://www.opengis.net/wfs,Query,wfs:Query
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/ogc,Filter,ogc:Filter
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/ogc,Within,ogc:Within
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/gml,Polygon,gml:Polygon
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/gml,outerBoundaryIs,gml:outerBoundaryIs
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/gml,LinearRing,gml:LinearRing
2008-05-16 18:07:58,598 TRACE [geotools.xml] - startElement(
http://www.opengis.net/gml,coordinates,gml:coordinates
2008-05-16 18:07:58,598 DEBUG [data.postgis] - get Feature source called on
FAST_PKT_PDA
2008-05-16 18:07:58,598 DEBUG [data.postgis] - returning pg feature locking
2008-05-16 18:07:58,598 WARN [geoserver.ows] -

Björn Harrtell ha scritto:

Hi, I'm having problems using spatial filter with a polygon. Example request below:

I've tried with various layers with different geometry type but getting the same error. Is this spatial filter type known to work?

The layers are in a PostGIS store (newest version of postgresql/postgis installed).

<wfs:GetFeature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
                xmlns:wfs="http://www.opengis.net/wfs&quot;
                xmlns:ogc="http://www.opengis.net/ogc&quot;
                service="WFS"
                version="1.1.0"
                xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd&quot;&gt;
   <wfs:Query typeName="sydvedbs:FAST_PKT_PDA">
      <ogc:Filter>
         <ogc:Within xmlns:gml="http://www.opengis.net/gml&quot;&gt;
            <gml:Polygon>
               <gml:outerBoundaryIs>
                  <gml:LinearRing>
                     <gml:coordinates>1250010,6399990 1399990,6399990 1399990,6250010 1250010,6250010 1250010,6399990 </gml:coordinates>
                  </gml:LinearRing>
               </gml:outerBoundaryIs>
            </gml:Polygon>
         </ogc:Within>
      </ogc:Filter>
   </wfs:Query>
</wfs:GetFeature>

I did not check, but I can tell you by default the xml parser is working
in a "tolerant" mode that may make it not throw errors and parse
succesfully only partially the xml. After this partial parsing things
may go downhill.
Can you go to the WFS configuration, enable the "CITE hacks", and
try again that request? This will turn the parser into "strict" mode,
and it will parse your request only if it's 100% correct in every detail, or throw an error if it's not.

(btw, if you ask why the strict mode is not enabled by default, it's
because there are lots of established clients out there that do
not make fully correct requests, but usually ones that we can parse
properly in "tolerant" mode).

Let me know how it goes.

Cheers
Andrea

Björn Harrtell ha scritto:
...

<wfs:GetFeature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
                xmlns:wfs="http://www.opengis.net/wfs&quot;
                xmlns:ogc="http://www.opengis.net/ogc&quot;
                service="WFS"
                version="1.1.0"
                xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd&quot;&gt;
   <wfs:Query typeName="sydvedbs:FAST_PKT_PDA">
      <ogc:Filter>
         <ogc:Within xmlns:gml="http://www.opengis.net/gml&quot;&gt;
            <gml:Polygon>
               <gml:outerBoundaryIs>
                  <gml:LinearRing>

Ah, wait a second, I think I know what's missing here. You did
not specify the name of the geometry property to be used for
the comparison. That field is mandatory, you should get the
error message about that if you switch the parser to strict
mode.

If you look into Rahkonen sample, he did set the PropertyName,
that's why it's working fine for him.

If you're making up WFS requests "by hand" I warmly suggest
you have a look at both the WFS and Filter specifications,
you can download them from the www.opengeospatial.org site
(pick the right version according to which WFS version
you want to use, WFS 1.0 uses Filter 1.0).

Cheers
Andrea

Yes the requests are handcrafted and you are right, but I did correct the initial request to inlclude ogc:PropertyName but still got the same error. After more testing it seems my request works with WFS 1.0.0 but not 1.1.0.. If it’s something I miss from the WFS 1.1.0 I apologize in advance (i’s not the lightest read documents :slight_smile:

So this request works:

<wfs:GetFeature xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:wfs=“http://www.opengis.net/wfs
xmlns:ogc=“http://www.opengis.net/ogc
service=“WFS”
version=“1.0.0”
xsi:schemaLocation=“http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd”>
<wfs:Query typeName=“sydvedbs:FAST_PKT_PDA”>
ogc:Filter
<ogc:Within xmlns:gml=“http://www.opengis.net/gml”>
ogc:PropertyName/
gml:Polygon
gml:outerBoundaryIs
gml:LinearRing
gml:coordinates1290010,6299990 1299990,6399990 1299990,6290010 1290010,6290010 1290010,6299990 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

However, if I use WFS 1.1.0 (just switch version in the above request) I get an exception like this:
<ows:ExceptionReport version=“1.0.0” xsi:schemaLocation=“http://www.opengis.net/ows http://sydvedtest.sweco.se:80/sydved_geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd”>
<ows:Exception exceptionCode=“InvalidParameterValue”>
ows:ExceptionText
Invalid request cvc-pattern-valid:
Value ‘sydvedbs:FAST_PKT_PDA’ is not facet-valid with
respect to pattern ‘((\w:)?\w(=\w)?){1,}’.
cvc-attribute.3: The value ‘sydvedbs:FAST_PKT_PDA’ of
attribute ‘typeName’ on element ‘wfs:Query’ is not
valid with respect to its type.
</ows:ExceptionText>
ows:ExceptionText
cvc-pattern-valid: Value
‘sydvedbs:FAST_PKT_PDA’ is not facet-valid with
respect to pattern ‘((\w:)?\w(=\w)?){1,}’.
</ows:ExceptionText>
ows:ExceptionText
cvc-attribute.3: The value
‘sydvedbs:FAST_PKT_PDA’ of attribute ‘typeName’ on
element ‘wfs:Query’ is not valid with respect to its type.
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

On Sat, May 17, 2008 at 3:35 PM, Andrea Aime <aaime@…1…> wrote:

Björn Harrtell ha scritto:

<wfs:GetFeature xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:wfs=“http://www.opengis.net/wfs
xmlns:ogc=“http://www.opengis.net/ogc
service=“WFS”
version=“1.1.0”
xsi:schemaLocation=“http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd”>
<wfs:Query typeName=“sydvedbs:FAST_PKT_PDA”>
ogc:Filter
<ogc:Within xmlns:gml=“http://www.opengis.net/gml”>
gml:Polygon
gml:outerBoundaryIs
gml:LinearRing

Ah, wait a second, I think I know what’s missing here. You did
not specify the name of the geometry property to be used for
the comparison. That field is mandatory, you should get the
error message about that if you switch the parser to strict
mode.

If you look into Rahkonen sample, he did set the PropertyName,
that’s why it’s working fine for him.

If you’re making up WFS requests “by hand” I warmly suggest
you have a look at both the WFS and Filter specifications,
you can download them from the www.opengeospatial.org site
(pick the right version according to which WFS version
you want to use, WFS 1.0 uses Filter 1.0).

Cheers
Andrea

Björn Harrtell ha scritto:

Yes the requests are handcrafted and you are right, but I did correct the initial request to inlclude ogc:PropertyName but still got the same error. After more testing it seems my request works with WFS 1.0.0 but not 1.1.0. <http://1.1.0.>. If it's something I miss from the WFS 1.1.0 I apologize in advance (i's not the lightest read documents :slight_smile:

Bad, the WFS protocol, building upon GML and Filter specs, is not an easy one, you have to master it a little before making requests.
It's not something you can get right using just a little of trial
and error.

So this request works:

<wfs:GetFeature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
                xmlns:wfs="http://www.opengis.net/wfs&quot;
                xmlns:ogc="http://www.opengis.net/ogc&quot;
                service="WFS"
                version="1.0.0"
                xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
   <wfs:Query typeName="sydvedbs:FAST_PKT_PDA">
      <ogc:Filter>
         <ogc:Within xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<ogc:PropertyName/>
            <gml:Polygon>
               <gml:outerBoundaryIs>
                  <gml:LinearRing>
                     <gml:coordinates>1290010,6299990 1299990,6399990 1299990,6290010 1290010,6290010 1290010,6299990 </gml:coordinates>
                  </gml:LinearRing>
               </gml:outerBoundaryIs>
            </gml:Polygon>
         </ogc:Within>
      </ogc:Filter>
   </wfs:Query>
</wfs:GetFeature>

However, if I use WFS 1.1.0 (just switch version in the above request) I get an exception like this:

Well, changing from WFS 1.0.0 to WFS 1.1.0 is not just switching version number, the protocol has changed, the geometries have to expressed in GML3 instead of GML2, schema locations are different, and so on.

Anyways, you have to specify the property name, not just leave it empty.
I'm frankly surprised it works at all with <ogc:PropertyName/>.

For the sample layer topp:states the geometry property is named "the_geom" so the property name would have to be:
<ogc:PropertyName>the_geom</PropertyName>

See how the geom property is called in your case and fix your request.

Cheers
Andrea

I see now that the request does not validate against http://schemas.opengis.net/wfs/1.1.0/wfs.xsd with the same error:

cvc-pattern-valid: Value ‘FAST_PKT_PDA’ is not facet-valid with respect to pattern ‘((\w:)?\w(=\w)?){1,}’ for type ‘TypeNameListType’. [7]
cvc-attribute.3: The value ‘FAST_PKT_PDA’ of attribute ‘typeName’ on element ‘wfs:Query’ is not valid with respect to its type, ‘TypeNameListType’. [7]
cvc-complex-type.2.4.d: Invalid content was found starting with element ‘ogc:PropertyName’. No child element is expected at this point. [10]
The element type “ogc:PropertyName” must be terminated by the matching end-tag “</ogc:PropertyName>”. [18]

Including the proper ogc:PropertyNamegeomogc:PropertyName/ (the field in postgis is geom here, not the_geom) doesn’t affect the outcome. I read somewhere that the geometry field should be identified by the server if not specified (not true?). I don’t really understand why the pattern ((\w:)?\w(=\w)?){1,} doesn’t match my typeName (tried without namespace also)

But this does seem to be more of a user problem than a geoserver problem. Sorry and thanks for guiding me onto the right track.

/Björn

On Sat, May 17, 2008 at 4:06 PM, Andrea Aime <aaime@…1…> wrote:

Björn Harrtell ha scritto:

Yes the requests are handcrafted and you are right, but I did correct the initial request to inlclude ogc:PropertyName but still got the same error. After more testing it seems my request works with WFS 1.0.0 but not 1.1.0. <http://1.1.0.>. If it’s something I miss from the WFS 1.1.0 I apologize in advance (i’s not the lightest read documents :slight_smile:

Bad, the WFS protocol, building upon GML and Filter specs, is not an easy one, you have to master it a little before making requests.
It’s not something you can get right using just a little of trial
and error.

So this request works:

<wfs:GetFeature xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xmlns:wfs=“http://www.opengis.net/wfs
xmlns:ogc=“http://www.opengis.net/ogc
service=“WFS”
version=“1.0.0”
xsi:schemaLocation=“http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd”>
<wfs:Query typeName=“sydvedbs:FAST_PKT_PDA”>
ogc:Filter
<ogc:Within xmlns:gml=“http://www.opengis.net/gml”>
ogc:PropertyName/
gml:Polygon
gml:outerBoundaryIs
gml:LinearRing
gml:coordinates1290010,6299990 1299990,6399990 1299990,6290010 1290010,6290010 1290010,6299990 </gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

However, if I use WFS 1.1.0 (just switch version in the above request) I get an exception like this:

Well, changing from WFS 1.0.0 to WFS 1.1.0 is not just switching version number, the protocol has changed, the geometries have to expressed in GML3 instead of GML2, schema locations are different, and so on.

Anyways, you have to specify the property name, not just leave it empty.
I’m frankly surprised it works at all with ogc:PropertyName/.

For the sample layer topp:states the geometry property is named “the_geom” so the property name would have to be:
ogc:PropertyNamethe_geom

See how the geom property is called in your case and fix your request.

Cheers
Andrea

Björn Harrtell ha scritto:

I see now that the request does not validate against http://schemas.opengis.net/wfs/1.1.0/wfs.xsd with the same error:

cvc-pattern-valid: Value 'FAST_PKT_PDA' is not facet-valid with respect to pattern '((\w:)?\w(=\w)?){1,}' for type 'TypeNameListType'. [7]
cvc-attribute.3: The value 'FAST_PKT_PDA' of attribute 'typeName' on element 'wfs:Query' is not valid with respect to its type, 'TypeNameListType'. [7]
cvc-complex-type.2.4.d: Invalid content was found starting with element 'ogc:PropertyName'. No child element is expected at this point. [10]
The element type "ogc:PropertyName" must be terminated by the matching end-tag "</ogc:PropertyName>". [18]

Hum, this time there is something else too:

"The element type "ogc:PropertyName" must be terminated by the matching
  end-tag "</ogc:PropertyName>". [18]"

In fact <ogc:PropertyName>geom<ogc:PropertyName/> is not valid, valid
xml is <ogc:PropertyName>geom</ogc:PropertyName>

Cheers
Andrea

Sorry that was a typo… ogc:PropertyNamegeom</ogc:PropertyName> is what I used. However it doesn’t seem to change anything and ogc:PropertyName/ seem to be accepted. The request works fine regardless in WFS 1.0.0 but doesn’t validate if changed to 1.1.0 due to the pattern matching problem.

/Björn

On Sat, May 17, 2008 at 4:25 PM, Andrea Aime <aaime@…1…> wrote:

Björn Harrtell ha scritto:

I see now that the request does not validate against http://schemas.opengis.net/wfs/1.1.0/wfs.xsd with the same error:

cvc-pattern-valid: Value ‘FAST_PKT_PDA’ is not facet-valid with respect to pattern ‘((\w:)?\w(=\w)?){1,}’ for type ‘TypeNameListType’. [7]
cvc-attribute.3: The value ‘FAST_PKT_PDA’ of attribute ‘typeName’ on element ‘wfs:Query’ is not valid with respect to its type, ‘TypeNameListType’. [7]
cvc-complex-type.2.4.d: Invalid content was found starting with element ‘ogc:PropertyName’. No child element is expected at this point. [10]
The element type “ogc:PropertyName” must be terminated by the matching end-tag “</ogc:PropertyName>”. [18]

Hum, this time there is something else too:

“The element type “ogc:PropertyName” must be terminated by the matching
end-tag “</ogc:PropertyName>”. [18]”

In fact ogc:PropertyNamegeomogc:PropertyName/ is not valid, valid
xml is ogc:PropertyNamegeom</ogc:PropertyName>

Cheers
Andrea

Hi,

OpenJUMP is creating request like the following for WFS 1.1.0. I hope it is useful, I don't understand too much about these things.

-Jukka Rahkonen-

<?xml version="1.0" encoding="ISO-8859-1"?>
<wfs:GetFeature xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:gml="http://www.opengis.net/gml&quot; xmlns:wfs="http://www.opengis.net/wfs&quot; service="WFS" version="1.1.0" maxFeatures="1000" outputFormat="text/xml; subtype=gml/3.1.1">
<wfs:Query xmlns:tiger="http://www.census.gov" srsName="urn:x-ogc:def:crs:EPSG:6.11.2:4326" typeName="tiger:giant_polygon">
<ogc:Filter>
<ogc:Within xmlns:gml='http://www.opengis.net/gml’ >
<ogc:PropertyName xmlns:tiger="http://www.census.gov">
tiger:the_geom</ogc:PropertyName>
<gml:Polygon srsName="EPSG:2393">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates cs="," decimal="." ts=" ">
3324152.1435882915,6871275.515392419 3422600.8503305903,6950669.633732983 3416249.320863345,6845869.397523439 3343206.731990027,6817287.514920835 3324152.1435882915,6871275.515392419</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

On Sat, May 17, 2008 at 4:25 PM, Andrea Aime <aaime@anonymised.com> wrote:

Björn Harrtell ha scritto:

I see now that the request does not validate against
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd with the same error:

cvc-pattern-valid: Value 'FAST_PKT_PDA' is not facet-valid with respect to

pattern '((\w:)?\w(=\w)?){1,}' for type 'TypeNameListType'. [7]
cvc-attribute.3: The value 'FAST_PKT_PDA' of attribute 'typeName' on
element 'wfs:Query' is not valid with respect to its type,
'TypeNameListType'. [7]
cvc-complex-type.2.4.d: Invalid content was found starting with element
'ogc:PropertyName'. No child element is expected at this point. [10]
The element type "ogc:PropertyName" must be terminated by the matching
end-tag "</ogc:PropertyName>". [18]

Hum, this time there is something else too:

"The element type "ogc:PropertyName" must be terminated by the matching
end-tag "</ogc:PropertyName>". [18]"

In fact <ogc:PropertyName>geom<ogc:PropertyName/> is not valid, valid
xml is <ogc:PropertyName>geom</ogc:PropertyName>

Cheers
Andrea

In a way it does. Thanks :slight_smile: It seems that this request doesn’t validate against the spec either… with the error message:

cvc-pattern-valid: Value ‘tiger:giant_polygon’ is not facet-valid with respect to pattern ‘((\w:)?\w(=\w)?){1,}’ for type ‘TypeNameListType’. [10]
cvc-attribute.3: The value ‘tiger:giant_polygon’ of attribute ‘typeName’ on element ‘wfs:Query’ is not valid with respect to its type, ‘TypeNameListType’. [10]

But this only shows up as an error in geoserver when using Strict CITE mode. If I turn it off, I can get my WFS 1.1.0 request to work too and the reason for it not working was the missing ogc:PropertyName

I was looking in the wrong places from the start with this problem… I need to take more care to follow the standards when handcrafting the requests.

But it would be good to know the explanation for the pattern matching validation problem.

/Björn

On Sat, May 17, 2008 at 5:06 PM, Rahkonen Jukka <Jukka.Rahkonen@…486…> wrote:

Hi,

OpenJUMP is creating request like the following for WFS 1.1.0. I hope it is useful, I don’t understand too much about these things.

-Jukka Rahkonen-

<?xml version="1.0" encoding="ISO-8859-1"?>

<wfs:GetFeature xmlns:ogc=“http://www.opengis.net/ogc” xmlns:gml=“http://www.opengis.net/gml” xmlns:wfs=“http://www.opengis.net/wfs” service=“WFS” version=“1.1.0” maxFeatures=“1000” outputFormat=“text/xml; subtype=gml/3.1.1”>
<wfs:Query xmlns:tiger=“http://www.census.gov” srsName=“urn:x-ogc:def:crs:EPSG:6.11.2:4326” typeName=“tiger:giant_polygon”>
ogc:Filter
<ogc:Within xmlns:gml=‘http://www.opengis.net/gml’ >
<ogc:PropertyName xmlns:tiger=“http://www.census.gov”>
tiger:the_geom</ogc:PropertyName>

<gml:Polygon srsName=“EPSG:2393”>

gml:outerBoundaryIs
gml:LinearRing
<gml:coordinates cs=“,” decimal=“.” ts=" ">
3324152.1435882915,6871275.515392419 3422600.8503305903,6950669.633732983 3416249.320863345,6845869.397523439 3343206.731990027,6817287.514920835 3324152.1435882915,6871275.515392419</gml:coordinates>

</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Within>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

On Sat, May 17, 2008 at 4:25 PM, Andrea Aime <aaime@…1…> wrote:

Björn Harrtell ha scritto:

I see now that the request does not validate against
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd with the same error:

cvc-pattern-valid: Value ‘FAST_PKT_PDA’ is not facet-valid with respect to

pattern ‘((\w:)?\w(=\w)?){1,}’ for type ‘TypeNameListType’. [7]
cvc-attribute.3: The value ‘FAST_PKT_PDA’ of attribute ‘typeName’ on
element ‘wfs:Query’ is not valid with respect to its type,
‘TypeNameListType’. [7]
cvc-complex-type.2.4.d: Invalid content was found starting with element
‘ogc:PropertyName’. No child element is expected at this point. [10]
The element type “ogc:PropertyName” must be terminated by the matching
end-tag “</ogc:PropertyName>”. [18]

Hum, this time there is something else too:

“The element type “ogc:PropertyName” must be terminated by the matching
end-tag “</ogc:PropertyName>”. [18]”

In fact ogc:PropertyNamegeomogc:PropertyName/ is not valid, valid
xml is ogc:PropertyNamegeom</ogc:PropertyName>

Cheers
Andrea

Yes, unfortunately the restrictions on type names prohibit the use of underscores, which is crazy to me and i did bring it up on the wfs-dev list with little response. However this will only occur in strict or cite mode.

Also, one thing to keep in mind with wfs 1.0 to wfs 1.1 is that gml geometries change as well. In your request gml:outerBoundaryIs -> gml:outer and gml:innerBoundaryIs -> gml:inner. However, in non strict mode this should be handled.

-Justin

Björn Harrtell wrote:

Sorry that was a typo.. <ogc:PropertyName>geom</ogc:PropertyName> is what I used. However it doesn't seem to change anything and <ogc:PropertyName/> seem to be accepted. The request works fine regardless in WFS 1.0.0 but doesn't validate if changed to 1.1.0 due to the pattern matching problem.

/Björn

On Sat, May 17, 2008 at 4:25 PM, Andrea Aime <aaime@anonymised.com <mailto:aaime@anonymised.com>> wrote:

    Björn Harrtell ha scritto:

        I see now that the request does not validate against
        http://schemas.opengis.net/wfs/1.1.0/wfs.xsd with the same error:

        cvc-pattern-valid: Value 'FAST_PKT_PDA' is not facet-valid with
        respect to pattern '((\w:)?\w(=\w)?){1,}' for type
        'TypeNameListType'. [7]
        cvc-attribute.3: The value 'FAST_PKT_PDA' of attribute
        'typeName' on element 'wfs:Query' is not valid with respect to
        its type, 'TypeNameListType'. [7]
        cvc-complex-type.2.4.d: Invalid content was found starting with
        element 'ogc:PropertyName'. No child element is expected at this
        point. [10]
        The element type "ogc:PropertyName" must be terminated by the
        matching end-tag "</ogc:PropertyName>". [18]

    Hum, this time there is something else too:

    "The element type "ogc:PropertyName" must be terminated by the matching
     end-tag "</ogc:PropertyName>". [18]"

    In fact <ogc:PropertyName>geom<ogc:PropertyName/> is not valid, valid
    xml is <ogc:PropertyName>geom</ogc:PropertyName>

    Cheers
    Andrea

!DSPAM:4007,482eec0a25822092453641!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com