File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -2715,13 +2715,26 @@ QList< QgsVectorFileWriter::FilterFormatDetails > QgsVectorFileWriter::supported
2715
2715
if ( drv )
2716
2716
{
2717
2717
QString drvName = OGR_Dr_GetName ( drv );
2718
+
2719
+ #if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,3,0)
2720
+ GDALDriverH gdalDriver = GDALGetDriverByName ( drvName.toLocal8Bit ().constData () );
2721
+ char **driverMetadata = nullptr ;
2722
+ if ( gdalDriver )
2723
+ {
2724
+ driverMetadata = GDALGetMetadata ( gdalDriver, nullptr );
2725
+ }
2726
+
2727
+ bool nonSpatialFormat = nonSpatialFormat = CSLFetchBoolean ( driverMetadata, GDAL_DCAP_NONSPATIAL, false );
2728
+ #else
2729
+ bool nonSpatialFormat = ( drvName == QLatin1String ( " ODS" ) || drvName == QLatin1String ( " XLSX" ) || drvName == QLatin1String ( " XLS" ) );
2730
+ #endif
2731
+
2718
2732
if ( OGR_Dr_TestCapability ( drv, " CreateDataSource" ) != 0 )
2719
2733
{
2720
2734
if ( options & SkipNonSpatialFormats )
2721
2735
{
2722
2736
// skip non-spatial formats
2723
- // TODO - use GDAL metadata to determine this, when support exists in GDAL
2724
- if ( drvName == QLatin1String ( " ODS" ) || drvName == QLatin1String ( " XLSX" ) || drvName == QLatin1String ( " XLS" ) )
2737
+ if ( nonSpatialFormat )
2725
2738
continue ;
2726
2739
}
2727
2740
You can’t perform that action at this time.
0 commit comments