Bug report #14139

Error inserting feature in WFS-T server

Added by Ivano Brunet about 8 years ago. Updated over 6 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Unknown
Affected QGIS version:2.12.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:22141

Description

Cannot insert a new feature composed by a single polygon/linestring into a geoserver multipolygon/multilinestring WFS-t layer.

It raises an error:

Could not commit changes to layer xxx:yyy

Errors: ERROR: 1 feature(s) not added.
Provider errors:
unsuccessful service response: Error performing insert: java.lang.String cannot be cast to com.vividsolutions.jts.geom.Geometry

But if create two polygon/linestring and merging them into a single feature, the insert works.

It seems QGis send a gml multypoligon feature if there is more than a polygon, a polygon feature otherwise, while geoserver needs a strictly corresponding feature type with that defined on the layer.

I think the correct behavior was to send a multi feature with a single polygon/linestring if the wfs layer is a multipolygon/multilinestring.

Associated revisions

Revision 76841634
Added by Alessandro Pasotti almost 8 years ago

Fix for simple geometries insert error in WFS-T

Fixes #14139 Error inserting feature in WFS-T server

Revision 86f0c5f7
Added by Alessandro Pasotti almost 8 years ago

Fix for simple geometries insert error in WFS-T

Fixes #14139 Error inserting feature in WFS-T server

(cherry-picked from commit 768416340fdf233f8f5ce8945636d8df8b2e4f48)

Signed-off-by: Larry Shaffer <>

History

#1 Updated by Jukka Rahkonen about 8 years ago

Yes, there is only one way to do it right and it is to respect the schema of the feature type. For example the schema of "topp:states" feature type can be checked with
http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=describefeaturetype&typename=topp:states

Result contains
<xsd:element maxOccurs="1" minOccurs="0" name="the_geom" nillable="true" type="gml:MultiPolygonPropertyType"/>
which means that WFS client must use either an empty geometry or or a MultiPolygon geometry in WFS transactions.

#2 Updated by Alessandro Pasotti almost 8 years ago

  • Status changed from Open to Closed

#3 Updated by Jürgen Fischer over 6 years ago

  • Category set to Unknown

Also available in: Atom PDF