Skip to content

Commit

Permalink
improve driver type detection
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Aug 27, 2020
1 parent 7f2240c commit 07c2e74
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/app/qgsoptions.cpp
Expand Up @@ -2282,18 +2282,17 @@ void QgsOptions::loadGdalDriverList()
}

// in GDAL 2.0 both vector and raster drivers are returned by GDALGetDriver
if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_RASTER, nullptr ) ) != QLatin1String( "YES" ) )
myGdalDriverDescription = GDALGetDescription( myGdalDriver );
myDrivers << myGdalDriverDescription;
if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_RASTER, nullptr ) ) == QLatin1String( "YES" ) )
{
driversType[myGdalDriverDescription] = QgsMapLayerType::VectorLayer;
driversType[myGdalDriverDescription] = QgsMapLayerType::RasterLayer;
}
else
else if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_VECTOR, nullptr ) ) == QLatin1String( "YES" ) )
{
driversType[myGdalDriverDescription] = QgsMapLayerType::RasterLayer;
driversType[myGdalDriverDescription] = QgsMapLayerType::VectorLayer;
}

myGdalDriverDescription = GDALGetDescription( myGdalDriver );
myDrivers << myGdalDriverDescription;

QgsDebugMsg( QStringLiteral( "driver #%1 - %2" ).arg( i ).arg( myGdalDriverDescription ) );

// get driver R/W flags, adopted from GDALGeneralCmdLineProcessor()
Expand Down

0 comments on commit 07c2e74

Please sign in to comment.