QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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"
25 
34 class CORE_EXPORT QgsGdalUtils
35 {
36  public:
37 
43  static bool supportsRasterCreate( GDALDriverH driver );
44 
49  static gdal::dataset_unique_ptr createSingleBandMemoryDataset( GDALDataType dataType, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs );
50 
55  static gdal::dataset_unique_ptr createMultiBandMemoryDataset( GDALDataType dataType, int bands, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs );
56 
61  static gdal::dataset_unique_ptr createSingleBandTiffDataset( const QString &filename, GDALDataType dataType, const QgsRectangle &extent, int width, int height, const QgsCoordinateReferenceSystem &crs );
62 
69  static bool resampleSingleBandRaster( GDALDatasetH hSrcDS, GDALDatasetH hDstDS, GDALResampleAlg resampleAlg, const char *pszCoordinateOperation );
70 
75  static QImage resampleImage( const QImage &image, QSize outputSize, GDALRIOResampleAlg resampleAlg );
76 
81  static QString helpCreationOptionsFormat( const QString &format );
82 
87  static QString validateCreationOptionsFormat( const QStringList &createOptions, const QString &format );
88 
93  static char **papszFromStringList( const QStringList &list );
94 
102  static gdal::dataset_unique_ptr imageToMemoryDataset( const QImage &image );
103 
111  static gdal::dataset_unique_ptr blockToSingleBandMemoryDataset( int pixelWidth, int pixelHeight, const QgsRectangle &extent, void *block, GDALDataType dataType );
112 
121  static GDALDatasetH rpcAwareAutoCreateWarpedVrt(
122  GDALDatasetH hSrcDS,
123  const char *pszSrcWKT,
124  const char *pszDstWKT,
125  GDALResampleAlg eResampleAlg,
126  double dfMaxError,
127  const GDALWarpOptions *psOptionsIn );
128 
137  static void *rpcAwareCreateTransformer( GDALDatasetH hSrcDS, GDALDatasetH hDstDS = nullptr, char **papszOptions = nullptr );
138 
139 #ifndef QT_NO_NETWORKPROXY
140  static void setupProxy();
142 #endif
143 
158  static bool pathIsCheapToOpen( const QString &path, int smallFileSizeLimit = 50000 );
159 
166  static QStringList multiLayerFileExtensions();
167 
174  static bool vrtMatchesLayerType( const QString &vrtPath, QgsMapLayerType type );
175 
176  friend class TestQgsGdalUtils;
177 };
178 
179 #endif // QGSGDALUTILS_H
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsMapLayerType
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgis.h:46
qgsogrutils.h
QgsGdalUtils
Utilities for working with GDAL.
Definition: qgsgdalutils.h:34
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
gdal::dataset_unique_ptr
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
Definition: qgsogrutils.h:139
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:211
GDALDatasetH
void * GDALDatasetH
Definition: qgsalignraster.h:28