Skip to content

Commit 6465af3

Browse files
committed
Call OGR_Fld_SetSubType before OGR_L_CreateField
1 parent caf0cf7 commit 6465af3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/core/qgsvectorfilewriter.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,15 @@ void QgsVectorFileWriter::init( QString vectorFileName,
579579
OGR_Fld_SetPrecision( fld.get(), ogrPrecision );
580580
}
581581

582+
switch ( attrField.type() )
583+
{
584+
case QVariant::Bool:
585+
OGR_Fld_SetSubType( fld.get(), OFSTBoolean );
586+
break;
587+
default:
588+
break;
589+
}
590+
582591
// create the field
583592
QgsDebugMsg( "creating field " + attrField.name() +
584593
" type " + QString( QVariant::typeToName( attrField.type() ) ) +
@@ -2047,7 +2056,6 @@ gdal::ogr_feature_unique_ptr QgsVectorFileWriter::createFeature( const QgsFeatur
20472056
break;
20482057
case QVariant::Bool:
20492058
OGR_F_SetFieldInteger( poFeature.get(), ogrField, attrValue.toInt() );
2050-
OGR_Fld_SetSubType( OGR_F_GetFieldDefnRef( poFeature.get(), ogrField ), OFSTBoolean );
20512059
break;
20522060
case QVariant::String:
20532061
OGR_F_SetFieldString( poFeature.get(), ogrField, mCodec->fromUnicode( attrValue.toString() ).constData() );

0 commit comments

Comments
 (0)