Skip to content
Permalink
Browse files

QgsVectorFilewriter skip default null options

Don't specify dataset options which have null default values. Setting
these as empty strings might introduce a different behavior than
expected.

For example not creating an xsd companion file for GML.
  • Loading branch information
m-kuhn committed Sep 6, 2017
1 parent 9c7b4f0 commit 21822a0bd3df19e7bb4eb8d52f2756df0b8658d8
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/qgsvectorfilewriter.cpp
@@ -1022,7 +1022,7 @@ QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()
"Note that the schema file isn't actually accessed by OGR, so it "
"is up to the user to ensure it will match the schema of the OGR "
"produced GML data file." ),
QLatin1String( "" ) // Default value
QString() // Default value
) );

datasetOptions.insert( QStringLiteral( "XSISCHEMA" ), new SetOption(
@@ -3215,7 +3215,7 @@ QStringList QgsVectorFileWriter::concatenateOptions( const QMap<QString, QgsVect
case QgsVectorFileWriter::String:
{
QgsVectorFileWriter::StringOption *opt = dynamic_cast<QgsVectorFileWriter::StringOption *>( option );
if ( opt )
if ( opt && !opt->defaultValue.isNull() )
{
list.append( QStringLiteral( "%1=%2" ).arg( it.key(), opt->defaultValue ) );
}

0 comments on commit 21822a0

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