Skip to content
Permalink
Browse files

Call OGR_Fld_SetSubType before OGR_L_CreateField

  • Loading branch information
pblottiere committed Nov 15, 2017
1 parent caf0cf7 commit 6465af3fd9533ec12b856021cbd24290f2799cea
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/core/qgsvectorfilewriter.cpp
@@ -579,6 +579,15 @@ void QgsVectorFileWriter::init( QString vectorFileName,
OGR_Fld_SetPrecision( fld.get(), ogrPrecision );
}

switch ( attrField.type() )
{
case QVariant::Bool:
OGR_Fld_SetSubType( fld.get(), OFSTBoolean );
break;
default:
break;
}

// create the field
QgsDebugMsg( "creating field " + attrField.name() +
" type " + QString( QVariant::typeToName( attrField.type() ) ) +
@@ -2047,7 +2056,6 @@ gdal::ogr_feature_unique_ptr QgsVectorFileWriter::createFeature( const QgsFeatur
break;
case QVariant::Bool:
OGR_F_SetFieldInteger( poFeature.get(), ogrField, attrValue.toInt() );
OGR_Fld_SetSubType( OGR_F_GetFieldDefnRef( poFeature.get(), ogrField ), OFSTBoolean );
break;
case QVariant::String:
OGR_F_SetFieldString( poFeature.get(), ogrField, mCodec->fromUnicode( attrValue.toString() ).constData() );

0 comments on commit 6465af3

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