Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2957 from boundlessgeo/wfs-t-fixes-14139
Fix for simple geometries insert error in WFS-T
  • Loading branch information
elpaso committed Mar 30, 2016
2 parents dccd731 + 7684163 commit 897cd3c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/providers/wfs/qgswfsprovider.cpp
Expand Up @@ -347,7 +347,14 @@ bool QgsWFSProvider::addFeatures( QgsFeatureList &flist )

//add geometry column (as gml)
QDomElement geomElem = transactionDoc.createElementNS( mWfsNamespace, mGeometryAttribute );
QDomElement gmlElem = QgsOgcUtils::geometryToGML( featureIt->constGeometry(), transactionDoc );

QgsGeometry the_geom( *featureIt->constGeometry() );
// convert to multi if the layer geom type is multi and the geom is not
if ( QGis::isMultiType( this->geometryType( ) ) && ! the_geom.isMultipart( ) )
{
the_geom.convertToMultiType();
}
QDomElement gmlElem = QgsOgcUtils::geometryToGML( &the_geom, transactionDoc );
if ( !gmlElem.isNull() )
{
gmlElem.setAttribute( "srsName", crs().authid() );
Expand Down Expand Up @@ -1409,6 +1416,7 @@ bool QgsWFSProvider::sendTransactionDocument( const QDomDocument& doc, QDomDocum

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

connect( reply, SIGNAL( finished() ), this, SLOT( networkRequestFinished() ) );
while ( !mNetworkRequestFinished )
Expand Down

0 comments on commit 897cd3c

Please sign in to comment.