File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -704,16 +704,19 @@ void QgsVectorFileWriter::init( QString vectorFileName,
704
704
}
705
705
706
706
case QVariant::Map:
707
+ {
707
708
// handle GPKG conversion to JSON
708
- if ( mOgrDriverName == QLatin1String ( " GPKG" ) )
709
+ const char *pszDataSubTypes = GDALGetMetadataItem ( poDriver, GDAL_DMD_CREATIONFIELDDATASUBTYPES, nullptr );
710
+ if ( pszDataSubTypes && strstr ( pszDataSubTypes, " JSON" ) )
709
711
{
710
712
ogrType = OFTString;
711
713
ogrSubType = OFSTJSON;
712
714
break ;
713
715
}
716
+ }
714
717
715
718
// intentional fall-through
716
- FALLTHROUGH
719
+ FALLTHROUGH
717
720
718
721
case QVariant::List:
719
722
// handle GPKG conversion to JSON
@@ -2936,8 +2939,10 @@ gdal::ogr_feature_unique_ptr QgsVectorFileWriter::createFeature( const QgsFeatur
2936
2939
FALLTHROUGH
2937
2940
2938
2941
case QVariant::Map:
2942
+ {
2939
2943
// handle GPKG conversion to JSON
2940
- if ( mOgrDriverName == QLatin1String ( " GPKG" ) )
2944
+ const char *pszDataSubTypes = GDALGetMetadataItem ( OGRGetDriverByName ( mOgrDriverName .toLocal8Bit ().constData () ), GDAL_DMD_CREATIONFIELDDATASUBTYPES, nullptr );
2945
+ if ( pszDataSubTypes && strstr ( pszDataSubTypes, " JSON" ) )
2941
2946
{
2942
2947
const QJsonDocument doc = QJsonDocument::fromVariant ( attrValue );
2943
2948
QString jsonString;
@@ -2949,9 +2954,10 @@ gdal::ogr_feature_unique_ptr QgsVectorFileWriter::createFeature( const QgsFeatur
2949
2954
OGR_F_SetFieldString ( poFeature.get (), ogrField, mCodec ->fromUnicode ( jsonString.constData () ) );
2950
2955
break ;
2951
2956
}
2957
+ }
2952
2958
2953
2959
// intentional fall-through
2954
- FALLTHROUGH
2960
+ FALLTHROUGH
2955
2961
2956
2962
2957
2963
default :
You can’t perform that action at this time.
0 commit comments