23 void QgsTransformAlgorithm::initParameters(
const QVariantMap & )
25 addParameter(
new QgsProcessingParameterCrs( QStringLiteral(
"TARGET_CRS" ), QObject::tr(
"Target CRS" ), QStringLiteral(
"EPSG:4326" ) ) );
33 QString QgsTransformAlgorithm::outputName()
const 35 return QObject::tr(
"Reprojected" );
43 QString QgsTransformAlgorithm::name()
const 45 return QStringLiteral(
"reprojectlayer" );
48 QString QgsTransformAlgorithm::displayName()
const 50 return QObject::tr(
"Reproject layer" );
53 QStringList QgsTransformAlgorithm::tags()
const 55 return QObject::tr(
"transform,reprojection,crs,srs,warp" ).split(
',' );
58 QString QgsTransformAlgorithm::group()
const 60 return QObject::tr(
"Vector general" );
63 QString QgsTransformAlgorithm::groupId()
const 65 return QStringLiteral(
"vectorgeneral" );
68 QString QgsTransformAlgorithm::shortHelpString()
const 70 return QObject::tr(
"This algorithm reprojects a vector layer. It creates a new layer with the same features " 71 "as the input one, but with geometries reprojected to a new CRS.\n\n" 72 "Attributes are not modified by this algorithm." );
75 QgsTransformAlgorithm *QgsTransformAlgorithm::createInstance()
const 77 return new QgsTransformAlgorithm();
82 prepareSource( parameters, context );
83 mDestCrs = parameterAsCrs( parameters, QStringLiteral(
"TARGET_CRS" ), context );
91 if ( !mCreatedTransform )
93 mCreatedTransform =
true;
114 feedback->
reportError( QObject::tr(
"Encountered a transform error when reprojecting feature with id %1." ).arg( f.
id() ) );
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...
OperationResult transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
QList< QgsFeature > QgsFeatureList
A geometry is the spatial representation of a feature.
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.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
Contains information about the context in which a coordinate transform is executed.
A coordinate reference system parameter for processing algorithms.
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
QgsCoordinateTransformContext transformContext
void clearGeometry()
Removes any geometry associated with the feature.
This class represents a coordinate reference system (CRS).
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
const QgsCoordinateReferenceSystem & outputCrs
Custom exception class for Coordinate Reference System related exceptions.
Contains information about the context in which a processing algorithm is executed.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.