mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-05 00:09:32 -04:00
add support for raster creation options to raster calculator (fix #39082)
This commit is contained in:
parent
17824ad647
commit
687e4e673a
@ -146,6 +146,24 @@ The optional ``feedback`` argument can be used for progress reporting and cancel
|
||||
Returns a description of the last error encountered.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
%End
|
||||
|
||||
void setCreateOptions( const QStringList &list );
|
||||
%Docstring
|
||||
Sets a list of data source creation options to use when creating the output raster file.
|
||||
|
||||
.. seealso:: :py:func:`createOptions`
|
||||
|
||||
.. versionadded:: 3.44
|
||||
%End
|
||||
|
||||
QStringList createOptions() const;
|
||||
%Docstring
|
||||
Returns the list of data source creation options which will be used when creating the output raster file.
|
||||
|
||||
.. seealso:: :py:func:`setCreateOptions`
|
||||
|
||||
.. versionadded:: 3.44
|
||||
%End
|
||||
|
||||
};
|
||||
|
@ -146,6 +146,24 @@ The optional ``feedback`` argument can be used for progress reporting and cancel
|
||||
Returns a description of the last error encountered.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
%End
|
||||
|
||||
void setCreateOptions( const QStringList &list );
|
||||
%Docstring
|
||||
Sets a list of data source creation options to use when creating the output raster file.
|
||||
|
||||
.. seealso:: :py:func:`createOptions`
|
||||
|
||||
.. versionadded:: 3.44
|
||||
%End
|
||||
|
||||
QStringList createOptions() const;
|
||||
%Docstring
|
||||
Returns the list of data source creation options which will be used when creating the output raster file.
|
||||
|
||||
.. seealso:: :py:func:`setCreateOptions`
|
||||
|
||||
.. versionadded:: 3.44
|
||||
%End
|
||||
|
||||
};
|
||||
|
@ -698,7 +698,7 @@ GDALDriverH QgsRasterCalculator::openOutputDriver()
|
||||
gdal::dataset_unique_ptr QgsRasterCalculator::openOutputFile( GDALDriverH outputDriver )
|
||||
{
|
||||
//open output file
|
||||
char **papszOptions = nullptr;
|
||||
char **papszOptions = QgsGdalUtils::papszFromStringList( mCreateOptions );
|
||||
gdal::dataset_unique_ptr outputDataset( GDALCreate( outputDriver, mOutputFile.toUtf8().constData(), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, papszOptions ) );
|
||||
if ( !outputDataset )
|
||||
{
|
||||
|
@ -160,6 +160,22 @@ class ANALYSIS_EXPORT QgsRasterCalculator
|
||||
*/
|
||||
QString lastError() const;
|
||||
|
||||
/**
|
||||
* Sets a list of data source creation options to use when creating the output raster file.
|
||||
*
|
||||
* \see createOptions()
|
||||
* \since QGIS 3.44
|
||||
*/
|
||||
void setCreateOptions( const QStringList &list ) { mCreateOptions = list; }
|
||||
|
||||
/**
|
||||
* Returns the list of data source creation options which will be used when creating the output raster file.
|
||||
*
|
||||
* \see setCreateOptions()
|
||||
* \since QGIS 3.44
|
||||
*/
|
||||
QStringList createOptions() const { return mCreateOptions; }
|
||||
|
||||
private:
|
||||
//default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory
|
||||
QgsRasterCalculator() = delete;
|
||||
@ -199,6 +215,7 @@ class ANALYSIS_EXPORT QgsRasterCalculator
|
||||
int mNumOutputRows = 0;
|
||||
|
||||
QString mLastError;
|
||||
QStringList mCreateOptions;
|
||||
|
||||
/***/
|
||||
QVector<QgsRasterCalculatorEntry> mRasterEntries;
|
||||
|
Loading…
x
Reference in New Issue
Block a user