24 QString QgsRuggednessAlgorithm::name()
const
26 return QStringLiteral(
"ruggednessindex" );
29 QString QgsRuggednessAlgorithm::displayName()
const
31 return QObject::tr(
"Ruggedness index" );
34 QStringList QgsRuggednessAlgorithm::tags()
const
36 return QObject::tr(
"dem,ruggedness,index,terrain" ).split(
',' );
39 QString QgsRuggednessAlgorithm::group()
const
41 return QObject::tr(
"Raster terrain analysis" );
44 QString QgsRuggednessAlgorithm::groupId()
const
46 return QStringLiteral(
"rasterterrainanalysis" );
49 QString QgsRuggednessAlgorithm::shortHelpString()
const
51 return QObject::tr(
"This algorithm calculates the quantitative measurement of terrain "
52 "heterogeneity described by Riley et al. (1999)." )
53 + QStringLiteral(
"\n\n" )
54 + QObject::tr(
"It is calculated for every location, by summarizing the change "
55 "in elevation within the 3x3 pixel grid. Each pixel contains the "
56 "difference in elevation from a center cell and the 8 cells surrounding it." );
59 QgsRuggednessAlgorithm *QgsRuggednessAlgorithm::createInstance()
const
61 return new QgsRuggednessAlgorithm();
64 void QgsRuggednessAlgorithm::initAlgorithm(
const QVariantMap & )
75 QgsRasterLayer *inputLayer = parameterAsRasterLayer( parameters, QStringLiteral(
"INPUT" ), context );
80 double zFactor = parameterAsDouble( parameters, QStringLiteral(
"Z_FACTOR" ), context );
82 const QString outputFile = parameterAsOutputLayer( parameters, QStringLiteral(
"OUTPUT" ), context );
83 QFileInfo fi( outputFile );
87 ruggedness.setZFactor( zFactor );
88 ruggedness.processRaster( feedback );
91 outputs.insert( QStringLiteral(
"OUTPUT" ), outputFile );
QString source() const
Returns the source for the layer.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
A numeric parameter for processing algorithms.
@ Double
Double/float values.
A raster layer destination parameter, for specifying the destination path for a raster layer created ...
A raster layer parameter for processing algorithms.
static QString driverForExtension(const QString &extension)
Returns the GDAL driver name for a specified file extension.
Represents a raster layer.
Calculates the ruggedness index based on a 3x3 moving window.