QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgsgdalutils.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgdalutils.h
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#ifndef QGSGDALUTILS_H
17#define QGSGDALUTILS_H
18
19#define SIP_NO_FILE
20
21#include "qgis_core.h"
22#include <gdal.h>
23
24#include "qgsogrutils.h"
26
35class CORE_EXPORT QgsGdalUtils
36{
37 public:
38
44 static bool supportsRasterCreate( GDALDriverH driver );
45
50 static gdal::dataset_unique_ptr createSingleBandMemoryDataset( GDALDataType dataType, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs );
51
56 static gdal::dataset_unique_ptr createMultiBandMemoryDataset( GDALDataType dataType, int bands, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs );
57
62 static gdal::dataset_unique_ptr createSingleBandTiffDataset( const QString &filename, GDALDataType dataType, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs );
63
74 static bool resampleSingleBandRaster( GDALDatasetH hSrcDS, GDALDatasetH hDstDS, GDALResampleAlg resampleAlg, const char *pszCoordinateOperation );
75
87 static bool resampleSingleBandRaster( GDALDatasetH hSrcDS,
88 GDALDatasetH hDstDS,
89 GDALResampleAlg resampleAlg,
90 const QgsCoordinateReferenceSystem &sourceCrs,
91 const QgsCoordinateReferenceSystem &destinationCrs );
92
97 static QImage resampleImage( const QImage &image, QSize outputSize, GDALRIOResampleAlg resampleAlg );
98
103 static QString helpCreationOptionsFormat( const QString &format );
104
109 static QString validateCreationOptionsFormat( const QStringList &createOptions, const QString &format );
110
115 static char **papszFromStringList( const QStringList &list );
116
124 static gdal::dataset_unique_ptr imageToMemoryDataset( const QImage &image );
125
133 static gdal::dataset_unique_ptr blockToSingleBandMemoryDataset( int pixelWidth, int pixelHeight, const QgsRectangle &extent, void *block, GDALDataType dataType );
134
142 static gdal::dataset_unique_ptr blockToSingleBandMemoryDataset( const QgsRectangle &extent, QgsRasterBlock *block );
143
152 static gdal::dataset_unique_ptr blockToSingleBandMemoryDataset( double rotation, const QgsPointXY &origin, double gridXSize, double gridYSize, QgsRasterBlock *block );
153
162 static GDALDatasetH rpcAwareAutoCreateWarpedVrt(
163 GDALDatasetH hSrcDS,
164 const char *pszSrcWKT,
165 const char *pszDstWKT,
166 GDALResampleAlg eResampleAlg,
167 double dfMaxError,
168 const GDALWarpOptions *psOptionsIn );
169
178 static void *rpcAwareCreateTransformer( GDALDatasetH hSrcDS, GDALDatasetH hDstDS = nullptr, char **papszOptions = nullptr );
179
185 static GDALDataType gdalDataTypeFromQgisDataType( Qgis::DataType dataType );
186
192 static GDALResampleAlg gdalResamplingAlgorithm( QgsRasterDataProvider::ResamplingMethod method );
193
194#ifndef QT_NO_NETWORKPROXY
196 static void setupProxy();
197#endif
198
213 static bool pathIsCheapToOpen( const QString &path, int smallFileSizeLimit = 50000 );
214
221 static QStringList multiLayerFileExtensions();
222
229 static bool vrtMatchesLayerType( const QString &vrtPath, Qgis::LayerType type );
230
231 friend class TestQgsGdalUtils;
232};
233
234#endif // QGSGDALUTILS_H
DataType
Raster data types.
Definition: qgis.h:242
LayerType
Types of layers that can be added to a map.
Definition: qgis.h:115
This class represents a coordinate reference system (CRS).
Utilities for working with GDAL.
Definition: qgsgdalutils.h:36
A class to represent a 2D point.
Definition: qgspointxy.h:59
Raster data container.
ResamplingMethod
Resampling method for provider-level resampling.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
Definition: qgsogrutils.h:157
void * GDALDatasetH
const QgsCoordinateReferenceSystem & crs