[Geoserver-users] Looks a regression with WFS -- or it supposed to work this way?

In moving from 2.1.3 to 2.2.5, we have noticed a change in behaviour with WFS.

What I want: I want to make spatial query against a layer but I only want selected attributes returned. I specifically do not want geometry returned because the node count on the geometry can be very large.

To achieve this, I made WFS query as this:
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs&quot; service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
<wfs:Query typeName="wks:myWorkspace" srsName="EPSG:900913">
<wfs:PropertyName>REGION</wfs:PropertyName>
<wfs:PropertyName>SURVEY</wfs:PropertyName>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:Intersects>
<ogc:PropertyName></ogc:PropertyName>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml&quot; srsName="EPSG:900913">
<gml:exterior>
<gml:LinearRing>
<gml:posList>19173872.382729 -4704412.5602451 19203224.201586 -4770454.1526743 19100492.835585 -4816927.8658653 19173872.382729 -4704412.5602451</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</ogc:Intersects>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

This did work but no longer does so. To make it work, I have add
<wfs:PropertyName>SHAPE</wfs:PropertyName>

to the property list. If I do this of course, then I get the geometry returned to me.

Now maybe the change was to conform better to standards, but if not, its a regression.

--
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

On Thu, Mar 28, 2013 at 2:56 AM, Phil Scadden <p.scadden@anonymised.com> wrote:

In moving from 2.1.3 to 2.2.5, we have noticed a change in behaviour
with WFS.

What I want: I want to make spatial query against a layer but I only
want selected attributes returned. I specifically do not want geometry
returned because the node count on the geometry can be very large.

Look at the describe feature type result. Is the geometry field described as mandatory,
min occurrences = 1?
If so, the output is the expected one, you cannot select away fields that are supposed
to be mandatory in the schema.

GeoServer gets the mandatory/non mandatory from your data source, e.g., if it
is a database all non nullable fields are considered mandatory.
This can be manually overridden creating a custom schema file, see here:
http://docs.geoserver.org/stable/en/user/services/wfs/schemamapping.html

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Hi,

Geoserver should still return data even if geometry is mandatory in the schema but it is not listed in the request. From WFS 1.1.0 standard:

"The response to a GetFeature request must be valid according to the structure described by the XML Schema description of the feature type. Thus the WFS must report all the mandatory properties of each feature, as well any properties requested through the <wfs:PropertyName> element. In the event that a WFS encounters a query that does not select all mandatory properties of a feature, the WFS will internally augment the property name list to include all mandatory property names. A WFS client must thus be prepared to deal with a situation where it receives more property values than it requests through <wfs:PropertyName> elements."

-Jukka Rahkonen-

________________________________
Andrea Aime wrote:

On Thu, Mar 28, 2013 at 2:56 AM, Phil Scadden <p.scadden@anonymised.com<mailto:p.scadden@anonymised.com>> wrote:
In moving from 2.1.3 to 2.2.5, we have noticed a change in behaviour
with WFS.

What I want: I want to make spatial query against a layer but I only
want selected attributes returned. I specifically do not want geometry
returned because the node count on the geometry can be very large.

Look at the describe feature type result. Is the geometry field described as mandatory,
min occurrences = 1?
If so, the output is the expected one, you cannot select away fields that are supposed
to be mandatory in the schema.

GeoServer gets the mandatory/non mandatory from your data source, e.g., if it
is a database all non nullable fields are considered mandatory.
This can be manually overridden creating a custom schema file, see here:
http://docs.geoserver.org/stable/en/user/services/wfs/schemamapping.html

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------