Skip to content
Permalink
Browse files

Fix adding features with geometry to geometryless memory layer

  • Loading branch information
nyalldawson committed Feb 17, 2018
1 parent 0a5d486 commit 453c56e0704ff8a5eaa0e9dee78ad21da23ad1a1
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/core/providers/memory/qgsmemoryprovider.cpp
@@ -373,8 +373,12 @@ bool QgsMemoryProvider::addFeatures( QgsFeatureList &flist, Flags )
continue;
}

if ( it->hasGeometry() && QgsWkbTypes::geometryType( it->geometry().wkbType() ) !=
QgsWkbTypes::geometryType( mWkbType ) )
if ( it->hasGeometry() && mWkbType == QgsWkbTypes::NoGeometry )
{
it->clearGeometry();
}
else if ( it->hasGeometry() && QgsWkbTypes::geometryType( it->geometry().wkbType() ) !=
QgsWkbTypes::geometryType( mWkbType ) )
{
pushError( tr( "Could not add feature with geometry type %1 to layer of type %2" ).arg( QgsWkbTypes::displayString( it->geometry().wkbType() ),
QgsWkbTypes::displayString( mWkbType ) ) );

0 comments on commit 453c56e

Please sign in to comment.
You can’t perform that action at this time.