Class: QgsRemappingProxyFeatureSink

class qgis.core.QgsRemappingProxyFeatureSink

Bases: QgsFeatureSink

A QgsFeatureSink which proxies incoming features to a destination feature sink, after applying transformations and field value mappings.

This sink allows for transformation of incoming features to match the requirements of storing in an existing destination layer, e.g. by reprojecting the features to the destination’s CRS and by coercing geometries to the format required by the destination sink.

New in version 3.14.

QgsRemappingProxyFeatureSink(mappingDefinition: QgsRemappingSinkDefinition, sink: QgsFeatureSink) Constructor for QgsRemappingProxyFeatureSink, using the specified mappingDefinition to manipulate features before sending them to the destination sink.

QgsRemappingProxyFeatureSink(QgsRemappingProxyFeatureSink)

Methods

addFeature

param feature:

addFeatures

param features:

destinationSink

Returns the destination QgsFeatureSink which the proxy will forward features to.

lastError

rtype:

str

remapFeature

Remaps a feature to a set of features compatible with the destination sink.

setExpressionContext

Sets the expression context to use when evaluating mapped field values.

setTransformContext

Sets the transform context to use when reprojecting features.

addFeature(self, feature: QgsFeature, flags: QgsFeatureSink.Flags | QgsFeatureSink.Flag = QgsFeatureSink.Flags()) bool
Parameters:
Return type:

bool

addFeatures(self, features: Iterable[QgsFeature], flags: QgsFeatureSink.Flags | QgsFeatureSink.Flag = QgsFeatureSink.Flags()) bool
addFeatures(self, iterator: QgsFeatureIterator, flags: QgsFeatureSink.Flags | QgsFeatureSink.Flag = QgsFeatureSink.Flags()) bool
Parameters:
Return type:

bool

destinationSink(self) QgsFeatureSink

Returns the destination QgsFeatureSink which the proxy will forward features to.

Return type:

QgsFeatureSink

lastError(self) str
Return type:

str

remapFeature(self, feature: QgsFeature) List[QgsFeature]

Remaps a feature to a set of features compatible with the destination sink.

Parameters:

feature (QgsFeature) –

Return type:

List[QgsFeature]

setExpressionContext(self, context: QgsExpressionContext)

Sets the expression context to use when evaluating mapped field values.

Parameters:

context (QgsExpressionContext) –

setTransformContext(self, context: QgsCoordinateTransformContext)

Sets the transform context to use when reprojecting features.

Parameters:

context (QgsCoordinateTransformContext) –