23#define CPL_SUPRESS_CPLUSPLUS
25#include "gdalwarper.h"
26#include "cpl_string.h"
28#include <QNetworkProxy>
36 const QString driverShortName = GDALGetDriverShortName( driver );
37 if ( driverShortName == QLatin1String(
"SQLite" ) )
42 char **driverMetadata = GDALGetMetadata( driver,
nullptr );
43 return CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE,
false ) &&
44 CSLFetchBoolean( driverMetadata, GDAL_DCAP_RASTER,
false );
54 GDALDriverH hDriverMem = GDALGetDriverByName(
"MEM" );
62 const double cellSizeX = extent.
width() / width;
63 const double cellSizeY = extent.
height() / height;
64 double geoTransform[6];
66 geoTransform[1] = cellSizeX;
68 geoTransform[3] = extent.
yMinimum() + ( cellSizeY * height );
70 geoTransform[5] = -cellSizeY;
73 GDALSetGeoTransform( hSrcDS.get(), geoTransform );
79 const double cellSizeX = extent.
width() / width;
80 const double cellSizeY = extent.
height() / height;
81 double geoTransform[6];
83 geoTransform[1] = cellSizeX;
85 geoTransform[3] = extent.
yMinimum() + ( cellSizeY * height );
87 geoTransform[5] = -cellSizeY;
89 GDALDriverH hDriver = GDALGetDriverByName(
"GTiff" );
96 gdal::dataset_unique_ptr hDstDS( GDALCreate( hDriver, filename.toUtf8().constData(), width, height, 1, dataType,
nullptr ) );
104 GDALSetGeoTransform( hDstDS.get(), geoTransform );
110 if ( image.isNull() )
113 const QRgb *rgb =
reinterpret_cast<const QRgb *
>( image.constBits() );
114 GDALDriverH hDriverMem = GDALGetDriverByName(
"MEM" );
119 gdal::dataset_unique_ptr hSrcDS( GDALCreate( hDriverMem,
"", image.width(), image.height(), 0, GDT_Byte,
nullptr ) );
122 << QStringLiteral(
"PIXELOFFSET=%1" ).arg(
sizeof( QRgb ) )
123 << QStringLiteral(
"LINEOFFSET=%1" ).arg( image.bytesPerLine() )
124 << QStringLiteral(
"DATAPOINTER=%1" ).arg(
reinterpret_cast< qulonglong
>( rgb ) + 2 ) );
125 GDALAddBand( hSrcDS.get(), GDT_Byte, papszOptions );
126 CSLDestroy( papszOptions );
129 << QStringLiteral(
"PIXELOFFSET=%1" ).arg(
sizeof( QRgb ) )
130 << QStringLiteral(
"LINEOFFSET=%1" ).arg( image.bytesPerLine() )
131 << QStringLiteral(
"DATAPOINTER=%1" ).arg(
reinterpret_cast< qulonglong
>( rgb ) + 1 ) );
132 GDALAddBand( hSrcDS.get(), GDT_Byte, papszOptions );
133 CSLDestroy( papszOptions );
136 << QStringLiteral(
"PIXELOFFSET=%1" ).arg(
sizeof( QRgb ) )
137 << QStringLiteral(
"LINEOFFSET=%1" ).arg( image.bytesPerLine() )
138 << QStringLiteral(
"DATAPOINTER=%1" ).arg(
reinterpret_cast< qulonglong
>( rgb ) ) );
139 GDALAddBand( hSrcDS.get(), GDT_Byte, papszOptions );
140 CSLDestroy( papszOptions );
143 << QStringLiteral(
"PIXELOFFSET=%1" ).arg(
sizeof( QRgb ) )
144 << QStringLiteral(
"LINEOFFSET=%1" ).arg( image.bytesPerLine() )
145 << QStringLiteral(
"DATAPOINTER=%1" ).arg(
reinterpret_cast< qulonglong
>( rgb ) + 3 ) );
146 GDALAddBand( hSrcDS.get(), GDT_Byte, papszOptions );
147 CSLDestroy( papszOptions );
157 GDALDriverH hDriverMem = GDALGetDriverByName(
"MEM" );
161 const double cellSizeX = extent.
width() / pixelWidth;
162 const double cellSizeY = extent.
height() / pixelHeight;
163 double geoTransform[6];
164 geoTransform[0] = extent.
xMinimum();
165 geoTransform[1] = cellSizeX;
167 geoTransform[3] = extent.
yMinimum() + ( cellSizeY * pixelHeight );
169 geoTransform[5] = -cellSizeY;
173 int dataTypeSize = GDALGetDataTypeSizeBytes( dataType );
175 << QStringLiteral(
"PIXELOFFSET=%1" ).arg( dataTypeSize )
176 << QStringLiteral(
"LINEOFFSET=%1" ).arg( pixelWidth * dataTypeSize )
177 << QStringLiteral(
"DATAPOINTER=%1" ).arg(
reinterpret_cast< qulonglong
>( block ) ) );
178 GDALAddBand( hDstDS.get(), dataType, papszOptions );
179 CSLDestroy( papszOptions );
181 GDALSetGeoTransform( hDstDS.get(), geoTransform );
194 GDALRasterBandH band = GDALGetRasterBand( ret.get(), 1 );
196 GDALSetRasterNoDataValue( band, block->
noDataValue() );
213 GDALDriverH hDriverMem = GDALGetDriverByName(
"MEM" );
217 const double cellSizeX = gridXSize / block->
width();
218 const double cellSizeY = gridYSize / block->
height();
219 double geoTransform[6];
220 geoTransform[0] = origin.
x();
221 geoTransform[1] = cellSizeX * std::cos( rotation );
222 geoTransform[2] = cellSizeY * std::sin( rotation );
223 geoTransform[3] = origin.
y();
224 geoTransform[4] = cellSizeX * std::sin( rotation );
225 geoTransform[5] = -cellSizeY * std::cos( rotation );
230 int dataTypeSize = GDALGetDataTypeSizeBytes( dataType );
232 << QStringLiteral(
"PIXELOFFSET=%1" ).arg( dataTypeSize )
233 << QStringLiteral(
"LINEOFFSET=%1" ).arg( block->
width() * dataTypeSize )
234 << QStringLiteral(
"DATAPOINTER=%1" ).arg(
reinterpret_cast< qulonglong
>( block->
bits() ) ) );
235 GDALAddBand( hDstDS.get(), dataType, papszOptions );
236 CSLDestroy( papszOptions );
238 GDALSetGeoTransform( hDstDS.get(), geoTransform );
240 GDALRasterBandH band = GDALGetRasterBand( hDstDS.get(), 1 );
242 GDALSetRasterNoDataValue( band, block->
noDataValue() );
247static bool resampleSingleBandRasterStatic(
GDALDatasetH hSrcDS,
GDALDatasetH hDstDS, GDALResampleAlg resampleAlg,
char **papszOptions )
250 psWarpOptions->hSrcDS = hSrcDS;
251 psWarpOptions->hDstDS = hDstDS;
253 psWarpOptions->nBandCount = 1;
254 psWarpOptions->panSrcBands =
reinterpret_cast< int *
>( CPLMalloc(
sizeof(
int ) * 1 ) );
255 psWarpOptions->panDstBands =
reinterpret_cast< int *
>( CPLMalloc(
sizeof(
int ) * 1 ) );
256 psWarpOptions->panSrcBands[0] = 1;
257 psWarpOptions->panDstBands[0] = 1;
258 double noDataValue = GDALGetRasterNoDataValue( GDALGetRasterBand( hDstDS, 1 ),
nullptr );
259 psWarpOptions->padfDstNoDataReal =
reinterpret_cast< double *
>( CPLMalloc(
sizeof(
double ) * 1 ) );
260 psWarpOptions->padfDstNoDataReal[0] = noDataValue;
261 psWarpOptions->eResampleAlg = resampleAlg;
264 psWarpOptions->pTransformerArg = GDALCreateGenImgProjTransformer2( hSrcDS, hDstDS, papszOptions );
266 if ( ! psWarpOptions->pTransformerArg )
271 psWarpOptions->pfnTransformer = GDALGenImgProjTransform;
272 psWarpOptions->papszWarpOptions = CSLSetNameValue( psWarpOptions-> papszWarpOptions,
"INIT_DEST",
"NO_DATA" );
275 GDALWarpOperation oOperation;
276 oOperation.Initialize( psWarpOptions.get() );
278 const bool retVal { oOperation.ChunkAndWarpImage( 0, 0, GDALGetRasterXSize( hDstDS ), GDALGetRasterYSize( hDstDS ) ) == CE_None };
279 GDALDestroyGenImgProjTransformer( psWarpOptions->pTransformerArg );
285 char **papszOptions =
nullptr;
286 if ( pszCoordinateOperation !=
nullptr )
287 papszOptions = CSLSetNameValue( papszOptions,
"COORDINATE_OPERATION", pszCoordinateOperation );
289 bool result = resampleSingleBandRasterStatic( hSrcDS, hDstDS, resampleAlg, papszOptions );
290 CSLDestroy( papszOptions );
296 GDALResampleAlg resampleAlg,
300 char **papszOptions =
nullptr;
305 bool result = resampleSingleBandRasterStatic( hSrcDS, hDstDS, resampleAlg, papszOptions );
306 CSLDestroy( papszOptions );
316 GDALRasterIOExtraArg extra;
317 INIT_RASTERIO_EXTRA_ARG( extra );
318 extra.eResampleAlg = resampleAlg;
320 QImage res( outputSize, image.format() );
324 GByte *rgb =
reinterpret_cast<GByte *
>( res.bits() );
326 CPLErr err = GDALRasterIOEx( GDALGetRasterBand( srcDS.get(), 1 ), GF_Read, 0, 0, image.width(), image.height(), rgb + 2, outputSize.width(),
327 outputSize.height(), GDT_Byte,
sizeof( QRgb ), res.bytesPerLine(), &extra );
328 if ( err != CE_None )
330 QgsDebugMsg( QStringLiteral(
"failed to read red band" ) );
334 err = GDALRasterIOEx( GDALGetRasterBand( srcDS.get(), 2 ), GF_Read, 0, 0, image.width(), image.height(), rgb + 1, outputSize.width(),
335 outputSize.height(), GDT_Byte,
sizeof( QRgb ), res.bytesPerLine(), &extra );
336 if ( err != CE_None )
338 QgsDebugMsg( QStringLiteral(
"failed to read green band" ) );
342 err = GDALRasterIOEx( GDALGetRasterBand( srcDS.get(), 3 ), GF_Read, 0, 0, image.width(), image.height(), rgb, outputSize.width(),
343 outputSize.height(), GDT_Byte,
sizeof( QRgb ), res.bytesPerLine(), &extra );
344 if ( err != CE_None )
346 QgsDebugMsg( QStringLiteral(
"failed to read blue band" ) );
350 err = GDALRasterIOEx( GDALGetRasterBand( srcDS.get(), 4 ), GF_Read, 0, 0, image.width(), image.height(), rgb + 3, outputSize.width(),
351 outputSize.height(), GDT_Byte,
sizeof( QRgb ), res.bytesPerLine(), &extra );
352 if ( err != CE_None )
354 QgsDebugMsg( QStringLiteral(
"failed to read alpha band" ) );
364 GDALDriverH myGdalDriver = GDALGetDriverByName( format.toLocal8Bit().constData() );
368 char **GDALmetadata = GDALGetMetadata( myGdalDriver,
nullptr );
369 message += QLatin1String(
"Format Details:\n" );
370 message += QStringLiteral(
" Extension: %1\n" ).arg( CSLFetchNameValue( GDALmetadata, GDAL_DMD_EXTENSION ) );
371 message += QStringLiteral(
" Short Name: %1" ).arg( GDALGetDriverShortName( myGdalDriver ) );
372 message += QStringLiteral(
" / Long Name: %1\n" ).arg( GDALGetDriverLongName( myGdalDriver ) );
373 message += QStringLiteral(
" Help page: http://www.gdal.org/%1\n\n" ).arg( CSLFetchNameValue( GDALmetadata, GDAL_DMD_HELPTOPIC ) );
377 CPLXMLNode *psCOL = CPLParseXMLString( GDALGetMetadataItem( myGdalDriver,
378 GDAL_DMD_CREATIONOPTIONLIST,
"" ) );
379 char *pszFormattedXML = CPLSerializeXMLTree( psCOL );
380 if ( pszFormattedXML )
381 message += QString( pszFormattedXML );
383 CPLDestroyXMLNode( psCOL );
384 if ( pszFormattedXML )
385 CPLFree( pszFormattedXML );
392 char **papszRetList =
nullptr;
393 const auto constList = list;
394 for (
const QString &elem : constList )
396 papszRetList = CSLAddString( papszRetList, elem.toLocal8Bit().constData() );
403 GDALDriverH myGdalDriver = GDALGetDriverByName( format.toLocal8Bit().constData() );
404 if ( ! myGdalDriver )
405 return QStringLiteral(
"invalid GDAL driver" );
409 const int ok = GDALValidateCreationOptions( myGdalDriver, papszOptions );
410 CSLDestroy( papszOptions );
413 return QStringLiteral(
"Failed GDALValidateCreationOptions() test" );
419 const char *pszSrcWKT,
420 const char *pszDstWKT,
421 GDALResampleAlg eResampleAlg,
423 const GDALWarpOptions *psOptionsIn )
425 char **opts =
nullptr;
426 if ( GDALGetMetadata( hSrcDS,
"RPC" ) )
429 const char *heightOffStr = GDALGetMetadataItem( hSrcDS,
"HEIGHT_OFF",
"RPC" );
431 opts = CSLAddNameValue( opts,
"RPC_HEIGHT", heightOffStr );
434 return GDALAutoCreateWarpedVRTEx( hSrcDS, pszSrcWKT, pszDstWKT, eResampleAlg, dfMaxError, psOptionsIn, opts );
439 char **opts = CSLDuplicate( papszOptions );
440 if ( GDALGetMetadata( hSrcDS,
"RPC" ) )
443 const char *heightOffStr = GDALGetMetadataItem( hSrcDS,
"HEIGHT_OFF",
"RPC" );
445 opts = CSLAddNameValue( opts,
"RPC_HEIGHT", heightOffStr );
447 void *transformer = GDALCreateGenImgProjTransformer2( hSrcDS, hDstDS, opts );
457 return GDALDataType::GDT_Unknown;
460 return GDALDataType::GDT_Byte;
463#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,7,0)
464 return GDALDataType::GDT_Int8;
466 return GDALDataType::GDT_Unknown;
470 return GDALDataType::GDT_UInt16;
473 return GDALDataType::GDT_Int16;
476 return GDALDataType::GDT_UInt32;
479 return GDALDataType::GDT_Int32;
482 return GDALDataType::GDT_Float32;
485 return GDALDataType::GDT_Float64;
488 return GDALDataType::GDT_CInt16;
491 return GDALDataType::GDT_CInt32;
494 return GDALDataType::GDT_CFloat32;
497 return GDALDataType::GDT_CFloat64;
501 return GDALDataType::GDT_Unknown;
505 return GDALDataType::GDT_Unknown;
510 GDALResampleAlg eResampleAlg = GRA_NearestNeighbour;
515 eResampleAlg = GRA_NearestNeighbour;
519 eResampleAlg = GRA_Bilinear;
523 eResampleAlg = GRA_Cubic;
527 eResampleAlg = GRA_CubicSpline;
531 eResampleAlg = GRA_Lanczos;
535 eResampleAlg = GRA_Average;
539 eResampleAlg = GRA_Mode;
546#ifndef QT_NO_NETWORKPROXY
556 if ( settings.
value( QStringLiteral(
"proxy/proxyEnabled" ),
false ).toBool() )
560 if ( ! proxies.isEmpty() )
562 const QNetworkProxy proxy( proxies.first() );
567 const QString proxyHost( proxy.hostName() );
568 const quint16 proxyPort( proxy.port() );
570 const QString proxyUser( proxy.user() );
571 const QString proxyPassword( proxy.password() );
573 if ( ! proxyHost.isEmpty() )
575 QString connection( proxyHost );
578 connection +=
':' + QString::number( proxyPort );
580 CPLSetConfigOption(
"GDAL_HTTP_PROXY", connection.toUtf8() );
581 if ( ! proxyUser.isEmpty( ) )
583 QString credentials( proxyUser );
584 if ( ! proxyPassword.isEmpty( ) )
586 credentials +=
':' + proxyPassword;
588 CPLSetConfigOption(
"GDAL_HTTP_PROXYUSERPWD", credentials.toUtf8() );
597 const QFileInfo info( path );
598 const long long size = info.size();
604 const QString suffix = info.suffix().toLower();
605 static const QStringList sFileSizeDependentExtensions
607 QStringLiteral(
"xlsx" ),
608 QStringLiteral(
"ods" ),
609 QStringLiteral(
"csv" )
611 if ( sFileSizeDependentExtensions.contains( suffix ) )
614 return size < smallFileSizeLimit;
624#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,4,0)
626 static std::once_flag initialized;
627 static QStringList SUPPORTED_DB_LAYERS_EXTENSIONS;
628 std::call_once( initialized, [ = ]
632 GDALDriverH driver =
nullptr;
634 QSet< QString > extensions;
636 for (
int i = 0; i < GDALGetDriverCount(); ++i )
638 driver = GDALGetDriver( i );
645 bool isMultiLayer =
false;
646 if ( QString( GDALGetMetadataItem( driver, GDAL_DCAP_RASTER,
nullptr ) ) == QLatin1String(
"YES" ) )
648 if ( GDALGetMetadataItem( driver, GDAL_DMD_SUBDATASETS,
nullptr ) !=
nullptr )
653 if ( !isMultiLayer && QString( GDALGetMetadataItem( driver, GDAL_DCAP_VECTOR,
nullptr ) ) == QLatin1String(
"YES" ) )
655 if ( GDALGetMetadataItem( driver, GDAL_DCAP_MULTIPLE_VECTOR_LAYERS,
nullptr ) !=
nullptr )
664 const QString driverExtensions = GDALGetMetadataItem( driver, GDAL_DMD_EXTENSIONS,
"" );
665 if ( driverExtensions.isEmpty() )
668 const QStringList splitExtensions = driverExtensions.split(
' ', Qt::SkipEmptyParts );
670 for (
const QString &ext : splitExtensions )
671 extensions.insert( ext );
674 SUPPORTED_DB_LAYERS_EXTENSIONS = QStringList( extensions.constBegin(), extensions.constEnd() );
676 return SUPPORTED_DB_LAYERS_EXTENSIONS;
679 static const QStringList SUPPORTED_DB_LAYERS_EXTENSIONS
681 QStringLiteral(
"gpkg" ),
682 QStringLiteral(
"sqlite" ),
683 QStringLiteral(
"db" ),
684 QStringLiteral(
"gdb" ),
685 QStringLiteral(
"kml" ),
686 QStringLiteral(
"kmz" ),
687 QStringLiteral(
"osm" ),
688 QStringLiteral(
"mdb" ),
689 QStringLiteral(
"accdb" ),
690 QStringLiteral(
"xls" ),
691 QStringLiteral(
"xlsx" ),
692 QStringLiteral(
"ods" ),
693 QStringLiteral(
"gpx" ),
694 QStringLiteral(
"pdf" ),
695 QStringLiteral(
"pbf" ),
696 QStringLiteral(
"vrt" ),
697 QStringLiteral(
"nc" ),
698 QStringLiteral(
"shp.zip" ) };
699 return SUPPORTED_DB_LAYERS_EXTENSIONS;
705 CPLPushErrorHandler( CPLQuietErrorHandler );
707 GDALDriverH hDriver =
nullptr;
711 case Qgis::LayerType::Vector:
712 hDriver = GDALIdentifyDriverEx( vrtPath.toUtf8().constData(), GDAL_OF_VECTOR,
nullptr,
nullptr );
715 case Qgis::LayerType::Raster:
716 hDriver = GDALIdentifyDriverEx( vrtPath.toUtf8().constData(), GDAL_OF_RASTER,
nullptr,
nullptr );
719 case Qgis::LayerType::Plugin:
720 case Qgis::LayerType::Mesh:
721 case Qgis::LayerType::VectorTile:
722 case Qgis::LayerType::Annotation:
723 case Qgis::LayerType::PointCloud:
724 case Qgis::LayerType::Group:
728 CPLPopErrorHandler();
729 return static_cast< bool >( hDriver );
DataType
Raster data types.
@ Float32
Thirty two bit floating point (float)
@ CFloat64
Complex Float64.
@ Int16
Sixteen bit signed integer (qint16)
@ ARGB32_Premultiplied
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
@ Int8
Eight bit signed integer (qint8) (added in QGIS 3.30)
@ UInt16
Sixteen bit unsigned integer (quint16)
@ Byte
Eight bit unsigned integer (quint8)
@ UnknownDataType
Unknown or unspecified type.
@ ARGB32
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32.
@ Int32
Thirty two bit signed integer (qint32)
@ Float64
Sixty four bit floating point (double)
@ CFloat32
Complex Float32.
@ UInt32
Thirty two bit unsigned integer (quint32)
LayerType
Types of layers that can be added to a map.
This class represents a coordinate reference system (CRS).
@ WKT_PREFERRED_GDAL
Preferred format for conversion of CRS to WKT for use with the GDAL library.
QString toWkt(WktVariant variant=WKT1_GDAL, bool multiline=false, int indentationWidth=4) const
Returns a WKT representation of this CRS.
static bool pathIsCheapToOpen(const QString &path, int smallFileSizeLimit=50000)
Returns true if the dataset at the specified path is considered "cheap" to open.
static QString helpCreationOptionsFormat(const QString &format)
Gets creation options metadata for a given format.
static bool vrtMatchesLayerType(const QString &vrtPath, Qgis::LayerType type)
Returns true if the VRT file at the specified path is a VRT matching the given layer type.
static GDALResampleAlg gdalResamplingAlgorithm(QgsRasterDataProvider::ResamplingMethod method)
Returns the GDAL resampling method corresponding to the QGIS resampling method.
static bool resampleSingleBandRaster(GDALDatasetH hSrcDS, GDALDatasetH hDstDS, GDALResampleAlg resampleAlg, const char *pszCoordinateOperation)
Resamples a single band raster to the destination dataset with different resolution (and possibly wit...
static GDALDatasetH rpcAwareAutoCreateWarpedVrt(GDALDatasetH hSrcDS, const char *pszSrcWKT, const char *pszDstWKT, GDALResampleAlg eResampleAlg, double dfMaxError, const GDALWarpOptions *psOptionsIn)
This is a copy of GDALAutoCreateWarpedVRT optimized for imagery using RPC georeferencing that also se...
static bool supportsRasterCreate(GDALDriverH driver)
Reads whether a driver supports GDALCreate() for raster purposes.
static gdal::dataset_unique_ptr createSingleBandTiffDataset(const QString &filename, GDALDataType dataType, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs)
Creates a new single band TIFF dataset with given parameters.
static GDALDataType gdalDataTypeFromQgisDataType(Qgis::DataType dataType)
Returns the GDAL data type corresponding to the QGIS data type dataType.
static gdal::dataset_unique_ptr createSingleBandMemoryDataset(GDALDataType dataType, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs)
Creates a new single band memory dataset with given parameters.
static QString validateCreationOptionsFormat(const QStringList &createOptions, const QString &format)
Validates creation options for a given format, regardless of layer.
static gdal::dataset_unique_ptr blockToSingleBandMemoryDataset(int pixelWidth, int pixelHeight, const QgsRectangle &extent, void *block, GDALDataType dataType)
Converts a data block to a single band GDAL memory dataset.
static gdal::dataset_unique_ptr imageToMemoryDataset(const QImage &image)
Converts an image to a GDAL memory dataset by borrowing image data.
static void * rpcAwareCreateTransformer(GDALDatasetH hSrcDS, GDALDatasetH hDstDS=nullptr, char **papszOptions=nullptr)
This is a wrapper around GDALCreateGenImgProjTransformer2() that takes into account RPC georeferencin...
static void setupProxy()
Sets the gdal proxy variables.
static char ** papszFromStringList(const QStringList &list)
Helper function.
static QImage resampleImage(const QImage &image, QSize outputSize, GDALRIOResampleAlg resampleAlg)
Resamples a QImage image using GDAL resampler.
static gdal::dataset_unique_ptr createMultiBandMemoryDataset(GDALDataType dataType, int bands, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs)
Creates a new multi band memory dataset with given parameters.
static QStringList multiLayerFileExtensions()
Returns a list of file extensions which potentially contain multiple layers representing GDAL raster ...
static void warning(const QString &msg)
Goes to qWarning.
static QgsNetworkAccessManager * instance(Qt::ConnectionType connectionType=Qt::BlockingQueuedConnection)
Returns a pointer to the active QgsNetworkAccessManager for the current thread.
A class to represent a 2D point.
int width() const SIP_HOLDGIL
Returns the width (number of columns) of the raster block.
char * bits(int row, int column)
Returns a pointer to block data.
Qgis::DataType dataType() const SIP_HOLDGIL
Returns data type.
double noDataValue() const SIP_HOLDGIL
Returns no data value.
int height() const SIP_HOLDGIL
Returns the height (number of rows) of the raster block.
ResamplingMethod
Resampling method for provider-level resampling.
@ Lanczos
Lanczos windowed sinc interpolation (6x6 kernel)
@ Nearest
Nearest-neighbour resampling.
@ Mode
Mode (selects the value which appears most often of all the sampled points)
@ Bilinear
Bilinear (2x2 kernel) resampling.
@ Average
Average resampling.
@ CubicSpline
Cubic B-Spline Approximation (4x4 kernel)
@ Cubic
Cubic Convolution Approximation (4x4 kernel) resampling.
A rectangle specified with double values.
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
double height() const SIP_HOLDGIL
Returns the height of the rectangle.
double width() const SIP_HOLDGIL
Returns the width of the rectangle.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
std::unique_ptr< GDALWarpOptions, GDALWarpOptionsDeleter > warp_options_unique_ptr
Scoped GDAL warp options.
const QgsCoordinateReferenceSystem & crs