Skip to content
Permalink
Browse files

Merge algorithm reprojects layers so that all features are

in CRS of first input layer
  • Loading branch information
nyalldawson committed Jun 11, 2017
1 parent 5ba0b5c commit 386c4246b2d59c78b982877f10f58d32882f3bd1
Showing with 6 additions and 2 deletions.
  1. +2 −0 python/plugins/processing/algs/help/qgis.yaml
  2. +4 −2 python/plugins/processing/algs/qgis/Merge.py
@@ -314,6 +314,8 @@ qgis:mergevectorlayers: >

If attributes tables are different, the attribute table of the resulting layer will contain the attributes from both input layers.

The layers will all be reprojected to match the coordinate reference system of the first input layer.

qgis:multiparttosingleparts: >
This algorithm takes a vector layer with multipart geometries and generates a new one in which all geometries contain a single part. Features with multipart geometries are divided in as many different features as parts the geometry contain, and the same attributes are used for each of them.

@@ -30,6 +30,7 @@
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtCore import QVariant
from qgis.core import (QgsFields,
QgsFeatureRequest,
QgsProcessingUtils,
QgsProcessingParameterMultipleLayers,
QgsProcessingParameterDefinition,
@@ -104,12 +105,13 @@ def processAlgorithm(self, parameters, context, feedback):
fields.append(sfield)

total = 100.0 / totalFeatureCount
dest_crs = layers[0].crs()
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, layers[0].wkbType(), layers[0].crs())
fields, layers[0].wkbType(), dest_crs)

featureCount = 0
for layer in layers:
for feature in layer.getFeatures():
for feature in layer.getFeatures(QgsFeatureRequest().setDestinationCrs(dest_crs)):
if feedback.isCanceled():
break

0 comments on commit 386c424

Please sign in to comment.
You can’t perform that action at this time.