mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
Merge algorithm reprojects layers so that all features are
in CRS of first input layer
This commit is contained in:
parent
5ba0b5cd83
commit
386c4246b2
@ -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 @@ import os
|
||||
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 @@ class Merge(QgisAlgorithm):
|
||||
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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user