QGIS API Documentation  3.6.0-Noosa (5873452)
qgsgdalutils.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgdalutils.cpp
3  ----------------
4  begin : September 2018
5  copyright : (C) 2018 Even Rouault
6  email : even.rouault at spatialys.com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsgdalutils.h"
17 
18 #define CPL_SUPRESS_CPLUSPLUS //#spellok
19 #include "gdal.h"
20 #include "cpl_string.h"
21 
22 #include <QString>
23 
24 bool QgsGdalUtils::supportsRasterCreate( GDALDriverH driver )
25 {
26  QString driverShortName = GDALGetDriverShortName( driver );
27  if ( driverShortName == QLatin1String( "SQLite" ) )
28  {
29  // it supports Create() but only for vector side
30  return false;
31  }
32  char **driverMetadata = GDALGetMetadata( driver, nullptr );
33  return CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) &&
34  CSLFetchBoolean( driverMetadata, GDAL_DCAP_RASTER, false );
35 }
static bool supportsRasterCreate(GDALDriverH driver)
Reads whether a driver supports GDALCreate() for raster purposes.