Skip to content

Commit 86f0c5f

Browse files
elpasodakcarto
authored andcommitted
Fix for simple geometries insert error in WFS-T
Fixes #14139 Error inserting feature in WFS-T server (cherry-picked from commit 7684163) Signed-off-by: Larry Shaffer <lshaffer@boundlessgeo.com>
1 parent 0505ad0 commit 86f0c5f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/providers/wfs/qgswfsprovider.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,14 @@ bool QgsWFSProvider::addFeatures( QgsFeatureList &flist )
347347

348348
//add geometry column (as gml)
349349
QDomElement geomElem = transactionDoc.createElementNS( mWfsNamespace, mGeometryAttribute );
350-
QDomElement gmlElem = QgsOgcUtils::geometryToGML( featureIt->constGeometry(), transactionDoc );
350+
351+
QgsGeometry the_geom( *featureIt->constGeometry() );
352+
// convert to multi if the layer geom type is multi and the geom is not
353+
if ( QGis::isMultiType( this->geometryType( ) ) && ! the_geom.isMultipart( ) )
354+
{
355+
the_geom.convertToMultiType();
356+
}
357+
QDomElement gmlElem = QgsOgcUtils::geometryToGML( &the_geom, transactionDoc );
351358
if ( !gmlElem.isNull() )
352359
{
353360
gmlElem.setAttribute( "srsName", crs().authid() );
@@ -1409,6 +1416,7 @@ bool QgsWFSProvider::sendTransactionDocument( const QDomDocument& doc, QDomDocum
14091416

14101417
request.setHeader( QNetworkRequest::ContentTypeHeader, "text/xml" );
14111418
QNetworkReply* reply = QgsNetworkAccessManager::instance()->post( request, doc.toByteArray( -1 ) );
1419+
QgsDebugMsg( "WFS transaction: " + doc.toByteArray( ) );
14121420

14131421
connect( reply, SIGNAL( finished() ), this, SLOT( networkRequestFinished() ) );
14141422
while ( !mNetworkRequestFinished )

0 commit comments

Comments
 (0)