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 );