Skip to content
Permalink
Browse files

vector file writer: assume shapefiles contain multitype data (fixes #…

  • Loading branch information
jef-n committed Oct 22, 2014
1 parent 372c3ce commit 528c4cacb6beec73252477ea5e921d13741e37d8
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/core/qgsvectorfilewriter.cpp
@@ -1852,6 +1852,8 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
outputCRS = &layer->crs();
}

QGis::WkbType wkbType = layer->wkbType();

if ( layer->providerType() == "ogr" )
{
QStringList theURIParts = layer->dataProvider()->dataSourceUri().split( "|" );
@@ -1863,10 +1865,16 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
*errorMessage = QObject::tr( "Cannot overwrite a OGR layer in place" );
return ErrCreateDataSource;
}

// Shapefiles might contain multi types although wkbType() only reports singles
if ( layer->storageType() == "ESRI Shapefile" )
{
wkbType = QGis::multiType( wkbType );
}
}

QgsVectorFileWriter* writer =
new QgsVectorFileWriter( fileName, fileEncoding, skipAttributeCreation ? QgsFields() : layer->pendingFields(), layer->wkbType(), outputCRS, driverName, datasourceOptions, layerOptions, newFilename, symbologyExport );
new QgsVectorFileWriter( fileName, fileEncoding, skipAttributeCreation ? QgsFields() : layer->pendingFields(), wkbType, outputCRS, driverName, datasourceOptions, layerOptions, newFilename, symbologyExport );
writer->setSymbologyScaleDenominator( symbologyScale );

if ( newFilename )

0 comments on commit 528c4ca

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