QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
|
The raster file writer which allows you to save a raster to a new file. More...
#include <qgsrasterfilewriter.h>
Classes | |
struct | FilterFormatDetails |
Details of available filters and formats. More... | |
Public Types | |
enum | Mode { Raw = 0 , Image = 1 } |
enum | RasterFormatOption { SortRecommended = 1 << 1 } |
Options for sorting and filtering raster formats. More... | |
enum | WriterError { NoError = 0 , SourceProviderError = 1 , DestProviderError = 2 , CreateDatasourceError = 3 , WriteError = 4 , NoDataConflict = 5 , WriteCanceled = 6 } |
Public Member Functions | |
QgsRasterFileWriter (const QString &outputUrl) | |
Qgis::RasterBuildPyramidOption | buildPyramidsFlag () const |
Returns the pyramid building option. More... | |
QgsRasterDataProvider * | createMultiBandRaster (Qgis::DataType dataType, int width, int height, const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs, int nBands) |
Create a raster file with given number of bands without initializing the pixel data. More... | |
QgsRasterDataProvider * | createOneBandRaster (Qgis::DataType dataType, int width, int height, const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs) |
Create a raster file with one band without initializing the pixel data. More... | |
QStringList | createOptions () const |
int | maxTileHeight () const |
int | maxTileWidth () const |
QString | outputFormat () const |
QString | outputProviderKey () const |
QString | outputUrl () const |
Returns the output URL for the raster. More... | |
QStringList | pyramidsConfigOptions () const |
Qgis::RasterPyramidFormat | pyramidsFormat () const |
Returns the raster pyramid format. More... | |
QList< int > | pyramidsList () const |
QString | pyramidsResampling () const |
void | setBuildPyramidsFlag (Qgis::RasterBuildPyramidOption f) |
Sets the pyramid building option. More... | |
void | setCreateOptions (const QStringList &list) |
void | setMaxTileHeight (int h) |
void | setMaxTileWidth (int w) |
void | setOutputFormat (const QString &format) |
void | setOutputProviderKey (const QString &key) |
void | setPyramidsConfigOptions (const QStringList &list) |
void | setPyramidsFormat (Qgis::RasterPyramidFormat f) |
Sets the raster pyramid format. More... | |
void | setPyramidsList (const QList< int > &list) |
void | setPyramidsResampling (const QString &str) |
void | setTiledMode (bool t) |
bool | tiledMode () const |
WriterError | writeRaster (const QgsRasterPipe *pipe, int nCols, int nRows, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &transformContext, QgsRasterBlockFeedback *feedback=nullptr) |
Write raster file. More... | |
Q_DECL_DEPRECATED WriterError | writeRaster (const QgsRasterPipe *pipe, int nCols, int nRows, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &crs, QgsRasterBlockFeedback *feedback=nullptr) |
Write raster file. More... | |
Static Public Member Functions | |
static QString | driverForExtension (const QString &extension) |
Returns the GDAL driver name for a specified file extension. More... | |
static QStringList | extensionsForFormat (const QString &format) |
Returns a list of known file extensions for the given GDAL driver format. More... | |
static QString | filterForDriver (const QString &driverName) |
Creates a filter for an GDAL driver key. More... | |
static QList< QgsRasterFileWriter::FilterFormatDetails > | supportedFiltersAndFormats (RasterFormatOptions options=SortRecommended) |
Returns a list or pairs, with format filter string as first element and GDAL format key as second element. More... | |
static QStringList | supportedFormatExtensions (RasterFormatOptions options=SortRecommended) |
Returns a list of file extensions for supported formats. More... | |
The raster file writer which allows you to save a raster to a new file.
Definition at line 39 of file qgsrasterfilewriter.h.
Enumerator | |
---|---|
Raw | Raw data. |
Image | Rendered image. |
Definition at line 42 of file qgsrasterfilewriter.h.
Options for sorting and filtering raster formats.
Enumerator | |
---|---|
SortRecommended | Use recommended sort order, with extremely commonly used formats listed first. |
Definition at line 62 of file qgsrasterfilewriter.h.
Definition at line 47 of file qgsrasterfilewriter.h.
QgsRasterFileWriter::QgsRasterFileWriter | ( | const QString & | outputUrl | ) |
Definition at line 66 of file qgsrasterfilewriter.cpp.
|
inline |
Returns the pyramid building option.
Definition at line 151 of file qgsrasterfilewriter.h.
QgsRasterDataProvider * QgsRasterFileWriter::createMultiBandRaster | ( | Qgis::DataType | dataType, |
int | width, | ||
int | height, | ||
const QgsRectangle & | extent, | ||
const QgsCoordinateReferenceSystem & | crs, | ||
int | nBands | ||
) |
Create a raster file with given number of bands without initializing the pixel data.
Returned provider may be used to initialize the raster using writeBlock() calls. Ownership of the returned provider is passed to the caller.
nullptr
on error. Definition at line 54 of file qgsrasterfilewriter.cpp.
QgsRasterDataProvider * QgsRasterFileWriter::createOneBandRaster | ( | Qgis::DataType | dataType, |
int | width, | ||
int | height, | ||
const QgsRectangle & | extent, | ||
const QgsCoordinateReferenceSystem & | crs | ||
) |
Create a raster file with one band without initializing the pixel data.
Returned provider may be used to initialize the raster using writeBlock() calls. Ownership of the returned provider is passed to the caller.
nullptr
on error. Definition at line 42 of file qgsrasterfilewriter.cpp.
|
inline |
Definition at line 184 of file qgsrasterfilewriter.h.
|
static |
Returns the GDAL driver name for a specified file extension.
E.g. the driver name for the ".tif" extension is "GTiff". If no suitable drivers are found then an empty string is returned.
Note that this method works for all GDAL drivers, including those without create support (and which are not supported by QgsRasterFileWriter).
Definition at line 1067 of file qgsrasterfilewriter.cpp.
|
static |
Returns a list of known file extensions for the given GDAL driver format.
E.g. returns "tif", "tiff" for the format "GTiff".
If no matching format driver is found an empty list will be returned.
Note that this method works for all GDAL drivers, including those without create support (and which are not supported by QgsRasterFileWriter).
Definition at line 1102 of file qgsrasterfilewriter.cpp.
|
static |
Creates a filter for an GDAL driver key.
Definition at line 1116 of file qgsrasterfilewriter.cpp.
|
inline |
Definition at line 181 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 144 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 135 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 138 of file qgsrasterfilewriter.h.
|
inline |
Returns the output URL for the raster.
Definition at line 132 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 187 of file qgsrasterfilewriter.h.
|
inline |
Returns the raster pyramid format.
Definition at line 171 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 160 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 163 of file qgsrasterfilewriter.h.
|
inline |
Sets the pyramid building option.
Definition at line 158 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 183 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 180 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 143 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 134 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 137 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 186 of file qgsrasterfilewriter.h.
|
inline |
Sets the raster pyramid format.
Definition at line 178 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 161 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 164 of file qgsrasterfilewriter.h.
|
inline |
Definition at line 140 of file qgsrasterfilewriter.h.
|
static |
Returns a list or pairs, with format filter string as first element and GDAL format key as second element.
Relies on GDAL_DMD_EXTENSIONS metadata, if it is empty corresponding driver will be skipped even if supported.
The options argument can be used to control the sorting and filtering of returned formats.
Definition at line 1140 of file qgsrasterfilewriter.cpp.
|
static |
Returns a list of file extensions for supported formats.
The options argument can be used to control the sorting and filtering of returned formats.
Definition at line 1207 of file qgsrasterfilewriter.cpp.
|
inline |
Definition at line 141 of file qgsrasterfilewriter.h.
QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeRaster | ( | const QgsRasterPipe * | pipe, |
int | nCols, | ||
int | nRows, | ||
const QgsRectangle & | outputExtent, | ||
const QgsCoordinateReferenceSystem & | crs, | ||
const QgsCoordinateTransformContext & | transformContext, | ||
QgsRasterBlockFeedback * | feedback = nullptr |
||
) |
Write raster file.
pipe | raster pipe |
nCols | number of output columns |
nRows | number of output rows (or -1 to automatically calculate row number to have square pixels) |
outputExtent | extent to output |
crs | crs to reproject to |
transformContext | coordinate transform context |
feedback | optional feedback object for progress reports |
Definition at line 85 of file qgsrasterfilewriter.cpp.
QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeRaster | ( | const QgsRasterPipe * | pipe, |
int | nCols, | ||
int | nRows, | ||
const QgsRectangle & | outputExtent, | ||
const QgsCoordinateReferenceSystem & | crs, | ||
QgsRasterBlockFeedback * | feedback = nullptr |
||
) |
Write raster file.
pipe | raster pipe |
nCols | number of output columns |
nRows | number of output rows (or -1 to automatically calculate row number to have square pixels) |
outputExtent | extent to output |
crs | crs to reproject to |
feedback | optional feedback object for progress reports |
Definition at line 79 of file qgsrasterfilewriter.cpp.