23 const std::vector< QgsStatisticalSummary::Statistic > STATS
43 QString QgsExtractZMValuesAlgorithmBase::group()
const 45 return QObject::tr(
"Vector geometry" );
48 QString QgsExtractZMValuesAlgorithmBase::groupId()
const 50 return QStringLiteral(
"vectorgeometry" );
53 QString QgsExtractZMValuesAlgorithmBase::outputName()
const 55 return QObject::tr(
"Extracted" );
58 QList<int> QgsExtractZMValuesAlgorithmBase::inputLayerTypes()
const 68 void QgsExtractZMValuesAlgorithmBase::initParameters(
const QVariantMap & )
70 QStringList statChoices;
71 statChoices.reserve( STATS.size() );
78 QObject::tr(
"Summaries to calculate" ),
79 statChoices,
true, QVariantList() << 0 ) );
81 addParameter(
new QgsProcessingParameterString( QStringLiteral(
"COLUMN_PREFIX" ), QObject::tr(
"Output column prefix" ), mDefaultFieldPrefix,
false,
true ) );
84 QgsFields QgsExtractZMValuesAlgorithmBase::outputFields(
const QgsFields &inputFields )
const 91 mPrefix = parameterAsString( parameters, QStringLiteral(
"COLUMN_PREFIX" ), context );
93 const QList< int > stats = parameterAsEnums( parameters, QStringLiteral(
"SUMMARIES" ), context );
97 mStats |= STATS.at( s );
98 mSelectedStats << STATS.at( s );
109 attrs.reserve( attrs.count() + mSelectedStats.count() );
112 attrs.resize( attrs.count() + mNewFields.size() );
120 stat.addValue( mExtractValFunc( *it ) );
131 attrs.append( stat.statistic( s ) );
138 bool QgsExtractZMValuesAlgorithmBase::supportInPlaceEdit(
const QgsMapLayer *layer )
const 148 QgsExtractZValuesAlgorithm::QgsExtractZValuesAlgorithm()
150 mExtractValFunc = [](
const QgsPoint & p ) ->
double 154 mTestGeomFunc = [](
const QgsGeometry & g ) ->
bool 158 mDefaultFieldPrefix = QStringLiteral(
"z_" );
161 QString QgsExtractZValuesAlgorithm::name()
const 163 return QStringLiteral(
"extractzvalues" );
166 QString QgsExtractZValuesAlgorithm::displayName()
const 168 return QObject::tr(
"Extract Z values" );
173 return new QgsExtractZValuesAlgorithm();
176 QStringList QgsExtractZValuesAlgorithm::tags()
const 178 return QObject::tr(
"add,z,value,elevation,height,attribute,statistics,stats" ).split(
',' );
181 QString QgsExtractZValuesAlgorithm::shortHelpString()
const 183 return QObject::tr(
"Extracts z values from geometries into feature attributes.\n\n" 184 "By default only the z value from the first vertex of each feature is extracted, however the algorithm " 185 "can optionally calculate statistics on all of the geometry's z values, including sums, means, and minimums and maximums" );
188 QString QgsExtractZValuesAlgorithm::shortDescription()
const 190 return QObject::tr(
"Extracts z values (or z value statistics) from geometries into feature attributes." );
198 QgsExtractMValuesAlgorithm::QgsExtractMValuesAlgorithm()
200 mExtractValFunc = [](
const QgsPoint & p ) ->
double 204 mTestGeomFunc = [](
const QgsGeometry & g ) ->
bool 208 mDefaultFieldPrefix = QStringLiteral(
"m_" );
211 QString QgsExtractMValuesAlgorithm::name()
const 213 return QStringLiteral(
"extractmvalues" );
216 QString QgsExtractMValuesAlgorithm::displayName()
const 218 return QObject::tr(
"Extract M values" );
223 return new QgsExtractMValuesAlgorithm();
226 QStringList QgsExtractMValuesAlgorithm::tags()
const 228 return QObject::tr(
"add,m,value,measure,attribute,statistics,stats" ).split(
',' );
231 QString QgsExtractMValuesAlgorithm::shortHelpString()
const 233 return QObject::tr(
"Extracts m values from geometries into feature attributes.\n\n" 234 "By default only the m value from the first vertex of each feature is extracted, however the algorithm " 235 "can optionally calculate statistics on all of the geometry's m values, including sums, means, and minimums and maximums" );
238 QString QgsExtractMValuesAlgorithm::shortDescription()
const 240 return QObject::tr(
"Extracts m values (or m value statistics) from geometries into feature attributes." );
Base class for all map layer types.
Base class for providing feedback from a processing algorithm.
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
Statistic
Enumeration of flags that specify statistics to be calculated.
QList< QgsFeature > QgsFeatureList
QgsWkbTypes::Type wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
Variety (count of distinct) values.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
Abstract base class for processing algorithms.
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
An enum based parameter for processing algorithms, allowing for selection from predefined values...
static QgsFields combineFields(const QgsFields &fieldsA, const QgsFields &fieldsB)
Combines two field lists, avoiding duplicate field names (in a case-insensitive manner).
Inter quartile range (IQR)
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
First value (since QGIS 3.6)
Encapsulate a field in an attribute table or data source.
Point geometry type, with support for z-dimension and m-values.
Last value (since QGIS 3.6)
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
static QString shortName(QgsStatisticalSummary::Statistic statistic)
Returns a short, friendly display name for a statistic, suitable for use in a field name...
static QString displayName(QgsStatisticalSummary::Statistic statistic)
Returns the friendly display name for a statistic.
static bool hasM(Type type)
Tests whether a WKB type contains m values.
Standard deviation of values.
Calculator for summary statistics for a list of doubles.
QgsAbstractGeometry::vertex_iterator vertices_end() const
Returns STL-style iterator pointing to the imaginary vertex after the last vertex of the geometry...
Contains information about the context in which a processing algorithm is executed.
QgsAbstractGeometry::vertex_iterator vertices_begin() const
Returns STL-style iterator pointing to the first vertex of the geometry.
A string parameter for processing algorithms.
Any vector layer with geometry.
Range of values (max - min)