Skip to content

Commit

Permalink
more gdal test for Processing (#3893)
Browse files Browse the repository at this point in the history
* more gdal test for Processing
  • Loading branch information
ghtmtt authored and m-kuhn committed Dec 20, 2016
1 parent 76b796b commit eab5ae2
Show file tree
Hide file tree
Showing 3 changed files with 380 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/plugins/processing/tests/testdata/custom/polygon_mask.gfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>polygon_mask</Name>
<ElementPath>polygon_mask</ElementPath>
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>2</FeatureCount>
<ExtentXMin>18.67319</ExtentXMin>
<ExtentXMax>18.70090</ExtentXMax>
<ExtentYMin>45.77796</ExtentYMin>
<ExtentYMax>45.80786</ExtentYMax>
</DatasetSpecificInfo>
</GMLFeatureClass>
</GMLFeatureClassList>
24 changes: 24 additions & 0 deletions python/plugins/processing/tests/testdata/custom/polygon_mask.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>18.67319311115957</gml:X><gml:Y>45.77795780842602</gml:Y></gml:coord>
<gml:coord><gml:X>18.70090093189771</gml:X><gml:Y>45.80786158698488</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:polygon_mask fid="polygon_mask.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.6744202640594,45.798496472749385 18.683204095342351,45.807861586984885 18.68966279481511,45.80456765025378 18.694829754393318,45.800175734612303 18.694442232424951,45.796235927933921 18.683849965289628,45.790358511413707 18.675970351932861,45.790229337424257 18.673193111159573,45.789970989445344 18.6744202640594,45.798496472749385</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
</ogr:polygon_mask>
</gml:featureMember>
<gml:featureMember>
<ogr:polygon_mask fid="polygon_mask.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>18.690696186730751,45.786612465719507 18.694442232424951,45.791133555350441 18.70090093189771,45.785643660798598 18.699738365992616,45.781122571167664 18.688435641915287,45.777957808426017 18.680491441563792,45.779895418267841 18.6800393326007,45.783318528988403 18.690696186730751,45.786612465719507</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
</ogr:polygon_mask>
</gml:featureMember>
</ogr:FeatureCollection>
341 changes: 341 additions & 0 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,347 @@ tests:
name: expected/convex_hull_fields.gml
type: vector

- algorithm: gdalogr:aspect
name: aspect with standard parameters
params:
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
TRIG_ANGLE: false
ZERO_FLAT: false
ZEVENBERGEN: false
results:
OUTPUT:
hash: 8436df662a44a00762aa29768e5d6ecfaf2d42e9a4da02d8afc6e3f6
type: rasterhash

- algorithm: gdalogr:aspect
name: aspect without NULL (-9999) values (0 instead)
params:
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
TRIG_ANGLE: false
ZERO_FLAT: true
ZEVENBERGEN: false
results:
OUTPUT:
hash: 43cccb440c7febb0095103eee3509b740e9f1bf2b3ad3b8a4c25622e
type: rasterhash

- algorithm: gdalogr:aspect
name: aspect with trigonometric angle
params:
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
TRIG_ANGLE: true
ZERO_FLAT: false
ZEVENBERGEN: false
results:
OUTPUT:
hash: a95e8a09a613b551d3f33dfb4975c430f599dc55f761063ae9529124
type: rasterhash

- algorithm: gdalogr:aspect
name: aspect zevenbergen
params:
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
TRIG_ANGLE: false
ZERO_FLAT: false
ZEVENBERGEN: true
results:
OUTPUT:
hash: 2cd5868b21efbd286f4977795143c89df77ac8976f8bc2a2c4e310d8
type: rasterhash


- algorithm: gdalogr:aspect
name: aspect with edges
params:
BAND: 1
COMPUTE_EDGES: true
INPUT:
name: dem.tif
type: raster
TRIG_ANGLE: false
ZERO_FLAT: false
ZEVENBERGEN: false
results:
OUTPUT:
hash: d3a354c6e5f207779bb58f9bd23fd89a9f90a77d81aafc661d0ae077
type: rasterhash

- algorithm: gdalogr:cliprasterbyextent
name: standard clip raster by extent
params:
BIGTIFF: '0'
COMPRESS: '4'
INPUT:
name: dem.tif
type: raster
JPEGCOMPRESSION: 75
PREDICTOR: 1
PROJWIN: 18.67551824296977,18.697800756150787,45.78984181545589,45.804309302274866
RTYPE: '5'
TFW: false
TILED: false
ZLEVEL: 6
results:
OUTPUT:
hash: 9913a7c0e1ced2c2ce1cd8f0e8103475bc2b0dd4d1d0adafe4920f93
type: rasterhash

- algorithm: gdalogr:cliprasterbyextent
name: clip by extent and change no data values
params:
BIGTIFF: '0'
COMPRESS: '4'
INPUT:
name: dem.tif
type: raster
JPEGCOMPRESSION: 75
NO_DATA: '-9999'
PREDICTOR: 1
PROJWIN: 18.67460436727692,18.698371162148714,45.78995019401027,45.804344168369234
RTYPE: '5'
TFW: false
TILED: false
ZLEVEL: 6
results:
OUTPUT:
hash: df5de501bcec0c10f738d77f3b48d5545b48f0a22e0e028a8b1ccbe7
type: rasterhash


- algorithm: gdalogr:cliprasterbymasklayer
name: clip by extent standard (with crop to cutline)
params:
ALPHA_BAND: false
BIGTIFF: '0'
COMPRESS: '4'
CROP_TO_CUTLINE: true
INPUT:
name: dem.tif
type: raster
JPEGCOMPRESSION: 75
KEEP_RESOLUTION: false
MASK:
name: custom/polygon_mask.gml
type: vector
PREDICTOR: 1
RTYPE: '5'
TFW: false
TILED: false
ZLEVEL: 6
results:
OUTPUT:
hash: 4f4720e4efe59a7f238f622659917bbeb5262369d15d5e2917dbcf8b
type: rasterhash

- algorithm: gdalogr:cliprasterbymasklayer
name: clip by extent and change no data value
params:
ALPHA_BAND: false
BIGTIFF: '0'
COMPRESS: '4'
CROP_TO_CUTLINE: true
INPUT:
name: dem.tif
type: raster
JPEGCOMPRESSION: 75
KEEP_RESOLUTION: false
MASK:
name: custom/polygon_mask.gml
type: vector
NO_DATA: '-9999'
PREDICTOR: 1
RTYPE: '5'
TFW: false
TILED: false
ZLEVEL: 6
results:
OUTPUT:
hash: 1e0252e63c65dcf4ed1f2b17d2490d3e0331aeb59d8f59b59554f442
type: rasterhash

- algorithm: gdalogr:cliprasterbymasklayer
name: clip by extent and add alpha band
params:
ALPHA_BAND: true
BIGTIFF: '0'
COMPRESS: '4'
CROP_TO_CUTLINE: true
INPUT:
name: dem.tif
type: raster
JPEGCOMPRESSION: 75
KEEP_RESOLUTION: false
MASK:
name: custom/polygon_mask.gml
type: vector
PREDICTOR: 1
RTYPE: '5'
TFW: false
TILED: false
ZLEVEL: 6
results:
OUTPUT:
hash: 8f69431c6ff7db5174c1ca8e879ae39582fd4ce86f9b53edae0f38ce
type: rasterhash

- algorithm: gdalogr:cliprasterbymasklayer
name: clip by extent without cropping to cutline
params:
ALPHA_BAND: false
BIGTIFF: '0'
COMPRESS: '4'
CROP_TO_CUTLINE: false
INPUT:
name: dem.tif
type: raster
JPEGCOMPRESSION: 75
KEEP_RESOLUTION: false
MASK:
name: custom/polygon_mask.gml
type: vector
PREDICTOR: 1
RTYPE: '5'
TFW: false
TILED: false
ZLEVEL: 6
results:
OUTPUT:
hash: 638165612b8cf59c631533438633c6c5b0fd5d3698d6ce75b359eef3
type: rasterhash

- algorithm: gdalogr:hillshade
name: hillshade standard
params:
ALTITUDE: 45.0
AZIMUTH: 315.0
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
SCALE: 1.0
ZEVENBERGEN: false
Z_FACTOR: 1.0
results:
OUTPUT:
hash: e5cf91b875b918682e456463165eddc4af4ae8855b143068e198ce2a
type: rasterhash

- algorithm: gdalogr:hillshade
name: hillshade with edges calculation
params:
ALTITUDE: 45.0
AZIMUTH: 315.0
BAND: 1
COMPUTE_EDGES: true
INPUT:
name: dem.tif
type: raster
SCALE: 1.0
ZEVENBERGEN: false
Z_FACTOR: 1.0
results:
OUTPUT:
hash: 570671408b020c9cc817e876f0e8081e0b11920c7d297abfe1cb3368
type: rasterhash

- algorithm: gdalogr:hillshade
name: hillshade with zevenbergen formula
params:
ALTITUDE: 45.0
AZIMUTH: 315.0
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
SCALE: 1.0
ZEVENBERGEN: true
Z_FACTOR: 1.0
results:
OUTPUT:
hash: ce2174ab155023367d38785fb867456c6a1ae3535ea0ec5ad7a694d5
type: rasterhash

- algorithm: gdalogr:slope
name: slope with standard parameters
params:
AS_PERCENT: false
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
SCALE: 1.0
ZEVENBERGEN: false
results:
OUTPUT:
hash: 319c470de3315f440371d5df8a6e478a8ecaf1cf904a013dbf1b3a6a
type: rasterhash

- algorithm: gdalogr:slope
name: slope with edges
params:
AS_PERCENT: false
BAND: 1
COMPUTE_EDGES: true
INPUT:
name: dem.tif
type: raster
SCALE: 1.0
ZEVENBERGEN: false
results:
OUTPUT:
hash: f7f8df8b6517fd8660304f7f2fbd6ade2ae68035f4dd9a224c80b465
type: rasterhash

- algorithm: gdalogr:slope
name: slope with zevenbergen formula
params:
AS_PERCENT: false
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
SCALE: 1.0
ZEVENBERGEN: true
results:
OUTPUT:
hash: 90e42b1bc7be9cf7b4a729c6db44dde0bba39dd33012ade6bc8080e7
type: rasterhash

- algorithm: gdalogr:slope
name: slope with percent instead of degree
params:
AS_PERCENT: true
BAND: 1
COMPUTE_EDGES: false
INPUT:
name: dem.tif
type: raster
SCALE: 1.0
ZEVENBERGEN: false
results:
OUTPUT:
hash: c9dc888254a571e7fbf66691fb72b35f030f87decf59ce67e32ad89d
type: rasterhash

# These tests dissabled because algs require access to iface which
# is not available in the test suite.
Expand Down

0 comments on commit eab5ae2

Please sign in to comment.