QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
Utilities for working with GDAL. More...
#include <qgsgdalutils.h>
Static Public Member Functions | |
static gdal::dataset_unique_ptr | blockToSingleBandMemoryDataset (const QgsRectangle &extent, QgsRasterBlock *block) |
Converts a raster block to a single band GDAL memory dataset. | |
static gdal::dataset_unique_ptr | blockToSingleBandMemoryDataset (double rotation, const QgsPointXY &origin, double gridXSize, double gridYSize, QgsRasterBlock *block) |
Converts a raster block to a single band GDAL memory dataset with rotation angle,side sizes of the grid, origin if the grid (top left if rotation == 0) | |
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 | 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 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 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 GDALResampleAlg | gdalResamplingAlgorithm (QgsRasterDataProvider::ResamplingMethod method) |
Returns the GDAL resampling method corresponding to the QGIS resampling method. | |
static QString | helpCreationOptionsFormat (const QString &format) |
Gets creation options metadata for a given format. | |
static gdal::dataset_unique_ptr | imageToMemoryDataset (const QImage &image) |
Converts an image to a GDAL memory dataset by borrowing image data. | |
static bool | isVsiArchiveFileExtension (const QString &extension) |
Returns true if a file extension is a supported archive style container (e.g. | |
static bool | isVsiArchivePrefix (const QString &prefix) |
Returns true if prefix is a supported archive style container prefix (e.g. | |
static QStringList | multiLayerFileExtensions () |
Returns a list of file extensions which potentially contain multiple layers representing GDAL raster or vector layers. | |
static char ** | papszFromStringList (const QStringList &list) |
Helper function. | |
static bool | pathIsCheapToOpen (const QString &path, int smallFileSizeLimit=50000) |
Returns true if the dataset at the specified path is considered "cheap" to open. | |
static QImage | resampleImage (const QImage &image, QSize outputSize, GDALRIOResampleAlg resampleAlg) |
Resamples a QImage image using GDAL resampler. | |
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 with different CRS). | |
static bool | resampleSingleBandRaster (GDALDatasetH hSrcDS, GDALDatasetH hDstDS, GDALResampleAlg resampleAlg, const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs) |
Resamples a single band raster to the destination dataset with different resolution and different CRS. | |
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 sets RPC_HEIGHT in GDALCreateGenImgProjTransformer2 based on HEIGHT_OFF. | |
static void * | rpcAwareCreateTransformer (GDALDatasetH hSrcDS, GDALDatasetH hDstDS=nullptr, char **papszOptions=nullptr) |
This is a wrapper around GDALCreateGenImgProjTransformer2() that takes into account RPC georeferencing (it sets RPC_HEIGHT in GDALCreateGenImgProjTransformer2 based on HEIGHT_OFF). | |
static void | setupProxy () |
Sets the gdal proxy variables. | |
static bool | supportsRasterCreate (GDALDriverH driver) |
Reads whether a driver supports GDALCreate() for raster purposes. | |
static QString | validateCreationOptionsFormat (const QStringList &createOptions, const QString &format) |
Validates creation options for a given format, regardless of layer. | |
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 QStringList | vsiArchiveFileExtensions () |
Returns a list of file extensions which correspond to archive style containers supported by GDAL (e.g. | |
static QStringList | vsiArchivePrefixes () |
Returns a list of vsi prefixes which correspond to archive style containers (eg vsizip). | |
static QString | vsiPrefixForPath (const QString &path) |
Returns a the vsi prefix which corresponds to a file path, or an empty string if the path is not associated with a vsi prefix. | |
Friends | |
class | TestQgsGdalUtils |
Utilities for working with GDAL.
Definition at line 35 of file qgsgdalutils.h.
|
static |
Converts a raster block to a single band GDAL memory dataset.
Definition at line 186 of file qgsgdalutils.cpp.
|
static |
Converts a raster block to a single band GDAL memory dataset with rotation angle,side sizes of the grid, origin if the grid (top left if rotation == 0)
Definition at line 204 of file qgsgdalutils.cpp.
|
static |
Converts a data block to a single band GDAL memory dataset.
Definition at line 152 of file qgsgdalutils.cpp.
|
static |
Creates a new multi band memory dataset with given parameters.
Definition at line 52 of file qgsgdalutils.cpp.
|
static |
Creates a new single band memory dataset with given parameters.
Definition at line 47 of file qgsgdalutils.cpp.
|
static |
Creates a new single band TIFF dataset with given parameters.
Definition at line 77 of file qgsgdalutils.cpp.
|
static |
Returns the GDAL data type corresponding to the QGIS data type dataType.
Definition at line 453 of file qgsgdalutils.cpp.
|
static |
Returns the GDAL resampling method corresponding to the QGIS resampling method.
Definition at line 509 of file qgsgdalutils.cpp.
|
static |
Gets creation options metadata for a given format.
Definition at line 362 of file qgsgdalutils.cpp.
|
static |
Converts an image to a GDAL memory dataset by borrowing image data.
Definition at line 108 of file qgsgdalutils.cpp.
|
static |
Returns true
if a file extension is a supported archive style container (e.g.
".zip").
Definition at line 790 of file qgsgdalutils.cpp.
|
static |
Returns true
if prefix is a supported archive style container prefix (e.g.
"/vsizip/").
Definition at line 765 of file qgsgdalutils.cpp.
|
static |
Returns a list of file extensions which potentially contain multiple layers representing GDAL raster or vector layers.
Definition at line 623 of file qgsgdalutils.cpp.
|
static |
|
static |
Returns true
if the dataset at the specified path is considered "cheap" to open.
Datasets which are considered cheap to open may correspond to very small file sizes, or data types which only require some inexpensive header parsing to open.
One use case for this method is to test whether a remote dataset can be safely opened to resolve the geometry types and other metadata without causing undue network traffic.
The smallFileSizeLimit argument specifies the maximum file size (in bytes) which will be considered as small.
Definition at line 596 of file qgsgdalutils.cpp.
|
static |
Resamples a QImage image using GDAL resampler.
Definition at line 311 of file qgsgdalutils.cpp.
|
static |
Resamples a single band raster to the destination dataset with different resolution (and possibly with different CRS).
Ideally the source dataset should cover the whole area or the destination dataset.
In case of different CRS, the parameter pszCoordinateOperation is the Proj coordinate operation string, that can be obtained with QgsCoordinateTransformContext::calculateCoordinateOperation()
true
on success Definition at line 284 of file qgsgdalutils.cpp.
|
static |
Resamples a single band raster to the destination dataset with different resolution and different CRS.
Ideally the source dataset should cover the whole area or the destination dataset.
true
on success Definition at line 295 of file qgsgdalutils.cpp.
|
static |
This is a copy of GDALAutoCreateWarpedVRT optimized for imagery using RPC georeferencing that also sets RPC_HEIGHT in GDALCreateGenImgProjTransformer2 based on HEIGHT_OFF.
By default GDAL would assume that the imagery has zero elevation - if that is not the case, the image would not be shown in the correct location.
Definition at line 418 of file qgsgdalutils.cpp.
|
static |
This is a wrapper around GDALCreateGenImgProjTransformer2() that takes into account RPC georeferencing (it sets RPC_HEIGHT in GDALCreateGenImgProjTransformer2 based on HEIGHT_OFF).
By default GDAL would assume that the imagery has zero elevation - if that is not the case, the image would not be shown in the correct location.
Definition at line 438 of file qgsgdalutils.cpp.
|
static |
Sets the gdal proxy variables.
Definition at line 548 of file qgsgdalutils.cpp.
|
static |
Reads whether a driver supports GDALCreate() for raster purposes.
driver | GDAL driver |
true
if a driver supports GDALCreate() for raster purposes. Definition at line 34 of file qgsgdalutils.cpp.
|
static |
Validates creation options for a given format, regardless of layer.
Definition at line 402 of file qgsgdalutils.cpp.
|
static |
Returns true
if the VRT file at the specified path is a VRT matching the given layer type.
Definition at line 796 of file qgsgdalutils.cpp.
|
static |
Returns a list of file extensions which correspond to archive style containers supported by GDAL (e.g.
"zip").
Definition at line 770 of file qgsgdalutils.cpp.
|
static |
Returns a list of vsi prefixes which correspond to archive style containers (eg vsizip).
Definition at line 752 of file qgsgdalutils.cpp.
|
static |
Returns a the vsi prefix which corresponds to a file path, or an empty string if the path is not associated with a vsi prefix.
Definition at line 711 of file qgsgdalutils.cpp.
|
friend |
Definition at line 267 of file qgsgdalutils.h.