Skip to content

Commit

Permalink
[processing][saga] Fix error in merge vector layers
Browse files Browse the repository at this point in the history
Fixes #18545
  • Loading branch information
nyalldawson committed Jun 4, 2018
1 parent 1bc1790 commit b8ff44e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 3 deletions.
5 changes: 2 additions & 3 deletions python/plugins/processing/algs/saga/SagaAlgorithm.py
Expand Up @@ -28,7 +28,6 @@

import os
import importlib
from copy import deepcopy
from qgis.core import (Qgis,
QgsApplication,
QgsProcessingUtils,
Expand Down Expand Up @@ -226,8 +225,8 @@ def processAlgorithm(self, parameters, context, feedback):

self.exportedLayers[param.name()] = files
else:
temp_params = deepcopy(parameters)
for layer in layers:
temp_params = {}
temp_params[param.name()] = layer

if not crs:
Expand All @@ -237,7 +236,7 @@ def processAlgorithm(self, parameters, context, feedback):

crs = source.sourceCrs()

layer_path = self.parameterAsCompatibleSourceLayerPath(temp_params, param.name(), context, 'shp',
layer_path = self.parameterAsCompatibleSourceLayerPath(temp_params, param.name(), context, ['shp'], 'shp',
feedback=feedback)
if layer_path:
if param.name() in self.exportedLayers:
Expand Down
Binary file not shown.
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<SAGA_METADATA>
<HISTORY saga-version="2.3.1">
<MODULE library="shapes_tools" id="2" name="Merge Layers">
<OPTION type="boolean" id="SRCINFO" name="Add Source Information">TRUE</OPTION>
<OPTION type="boolean" id="MATCH" name="Match Fields by Name">TRUE</OPTION>
<INPUT_LIST type="shapes_list" id="INPUT" name="Layers">
<INPUT type="shapes_list" id="INPUT" name="Layers">
<FILE>/tmp/processing_b5cdddb281d444b789783dec9f1cb820/cb98869080f34caa92a02f614f97d98b/INPUT.shp</FILE>
</INPUT>
<INPUT type="shapes_list" id="INPUT" name="Layers">
<FILE>/tmp/processing_b5cdddb281d444b789783dec9f1cb820/0b3e8560d4b34ec09028f93b778ed98c/INPUT.shp</FILE>
</INPUT>
</INPUT_LIST>
<OUTPUT type="shapes" id="MERGED" name="Merged Layer">Merged Layers</OUTPUT>
</MODULE>
</HISTORY>
<SOURCE>
<FILE></FILE>
<DATABASE>
<FIELDS>
<FIELD TYPE="STRING">Source</FIELD>
<FIELD TYPE="STRING">fid</FIELD>
<FIELD TYPE="LONGINT">id</FIELD>
<FIELD TYPE="LONGINT">id2</FIELD>
</FIELDS>
</DATABASE>
<PROJECTION>
<OGC_WKT>GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]</OGC_WKT>
<PROJ4>+proj=longlat +a=6378137.000000 +b=6356752.314245 +no_defs</PROJ4>
<EPSG>-1</EPSG>
</PROJECTION>
</SOURCE>
<DESCRIPTION></DESCRIPTION>
</SAGA_METADATA>
@@ -0,0 +1 @@
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions python/plugins/processing/tests/testdata/saga_algorithm_tests.yaml
Expand Up @@ -46,6 +46,23 @@ tests:
name: expected/saga/add_grid_to_points.shp
type: vector

- algorithm: saga:mergevectorlayers
name: Merge vector layers
params:
INPUT:
params:
- name: points.gml
type: vector
- name: points_in_polys.gml
type: vector
type: multi
MATCH: true
SRCINFO: true
results:
MERGED:
name: expected/saga/merge_vector_layers.shp
type: vector

- algorithm: saga:reclassifyvaluessimple
name: Reclassify values (simple)
params:
Expand Down

0 comments on commit b8ff44e

Please sign in to comment.