Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #6864 from ghtmtt/fix_saga
[processing] fix broken SAGA algorithms
  • Loading branch information
m-kuhn committed May 2, 2018
2 parents 0bf7c76 + 7b3308d commit 0a269aa
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 5 deletions.
Expand Up @@ -2,6 +2,6 @@ Add Grid Values to Points
shapes_grid
QgsProcessingParameterFeatureSource|SHAPES|Points|0|None|False
QgsProcessingParameterMultipleLayers|GRIDS|Grids|3|None|False
QgsProcessingParameterEnum|INTERPOL|Interpolation|[0] Nearest Neighbor;[1] Bilinear Interpolation;[2] Inverse Distance Interpolation;[3] Bicubic Spline Interpolation;[4] B-Spline Interpolation
QgsProcessingParameterEnum|RESAMPLING|Interpolation|[0] Nearest Neighbor;[1] Bilinear Interpolation;[2] Inverse Distance Interpolation;[3] Bicubic Spline Interpolation;[4] B-Spline Interpolation
QgsProcessingParameterVectorDestination|RESULT|Result
AllowUnmatching
AllowUnmatching
Expand Up @@ -2,6 +2,6 @@ Add Grid Values to Shapes
shapes_grid
QgsProcessingParameterFeatureSource|SHAPES|Shapes|-1|None|False
QgsProcessingParameterMultipleLayers|GRIDS|Grids|3|None|False
QgsProcessingParameterEnum|INTERPOL|Interpolation|[0] Nearest Neighbor;[1] Bilinear Interpolation;[2] Inverse Distance Interpolation;[3] Bicubic Spline Interpolation;[4] B-Spline Interpolation
QgsProcessingParameterEnum|RESAMPLING|Interpolation|[0] Nearest Neighbor;[1] Bilinear Interpolation;[2] Inverse Distance Interpolation;[3] Bicubic Spline Interpolation;[4] B-Spline Interpolation
QgsProcessingParameterVectorDestination|RESULT|Result
AllowUnmatching
AllowUnmatching
Binary file not shown.
@@ -0,0 +1 @@
UTF-8
Binary file not shown.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -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.
@@ -0,0 +1 @@
UTF-8
Binary file not shown.
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<SAGA_METADATA>
<HISTORY saga-version="2.3.1">
<MODULE library="shapes_grid" id="0" name="Add Grid Values to Points">
<OPTION type="choice" id="RESAMPLING" name="Resampling" index="0">Nearest Neighbour</OPTION>
<INPUT type="shapes" id="SHAPES" name="Points">
<FILE>/home/matteo/lavori/QGIS/QGIS/python/plugins/processing/tests/testdata/custom/points_over.shp</FILE>
</INPUT>
<INPUT_LIST type="grid_list" id="GRIDS" name="Grids">
<dem type="grid_list" id="GRIDS" name="Grids">
<FILE>/tmp/processing_191a0ba083ee4f3cbe76ebdd4f2d1dd4/5a739aab49674ad783246ab18eadd71f/dem.sgrd</FILE>
</dem>
</INPUT_LIST>
<OUTPUT type="shapes" id="RESULT" name="Result">points_over</OUTPUT>
</MODULE>
</HISTORY>
<SOURCE>
<FILE></FILE>
<DATABASE>
<FIELDS>
<FIELD TYPE="LONGINT">id</FIELD>
<FIELD TYPE="DOUBLE">dem</FIELD>
</FIELDS>
</DATABASE>
<PROJECTION></PROJECTION>
</SOURCE>
<DESCRIPTION></DESCRIPTION>
</SAGA_METADATA>
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -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 @@ -28,3 +28,20 @@ tests:
BUFFER:
name: expected/saga/buffer_polys.shp
type: vector

- algorithm: saga:addrastervaluestopoints
name: Simple add raster values to points
params:
GRIDS:
params:
- name: dem.tif
type: raster
type: multi
RESAMPLING: 0
SHAPES:
name: custom/points_over.shp
type: vector
results:
RESULT:
name: expected/saga/add_grid_to_points.shp
type: vector
8 changes: 7 additions & 1 deletion python/testing/__init__.py
Expand Up @@ -130,7 +130,7 @@ def sort_by_pk_or_fid(f):
self,
geom0,
geom1,
'Features {}/{} differ in geometry: \n\n {}\n\n vs \n\n {}'.format(
'Features (Expected fid: {}, Result fid: {}) differ in geometry: \n\n Expected geometry:\n {}\n\n Result geometry:\n {}'.format(
feats[0].id(),
feats[1].id(),
geom0,
Expand All @@ -153,6 +153,12 @@ def sort_by_pk_or_fid(f):
if 'skip' in cmp:
continue

if use_asserts:
_TestCase.assertIn(
self,
field_expected.name().lower(),
[name.lower() for name in feats[1].fields().names()])

attr_result = feats[1][field_expected.name()]
field_result = [fld for fld in layer_expected.fields().toList() if fld.name() == field_expected.name()][0]

Expand Down

0 comments on commit 0a269aa

Please sign in to comment.