Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[processing] add unittest for gdal2xyz algorithm
- Loading branch information
|
@@ -61,6 +61,7 @@ |
|
|
from processing.algs.gdal.rearrange_bands import rearrange_bands |
|
|
from processing.algs.gdal.gdaladdo import gdaladdo |
|
|
from processing.algs.gdal.sieve import sieve |
|
|
from processing.algs.gdal.gdal2xyz import gdal2xyz |
|
|
|
|
|
from processing.tools.system import isWindows |
|
|
|
|
@@ -2514,6 +2515,38 @@ def testSieve(self): |
|
|
source + ' ' + |
|
|
outsource]) |
|
|
|
|
|
def testGdal2Xyz(self): |
|
|
context = QgsProcessingContext() |
|
|
feedback = QgsProcessingFeedback() |
|
|
source = os.path.join(testDataPath, 'dem.tif') |
|
|
|
|
|
with tempfile.TemporaryDirectory() as outdir: |
|
|
outsource = outdir + '/check.csv' |
|
|
alg = gdal2xyz() |
|
|
alg.initAlgorithm() |
|
|
|
|
|
# defaults |
|
|
self.assertEqual( |
|
|
alg.getConsoleCommands({'INPUT': source, |
|
|
'BAND': 1, |
|
|
'CSV': False, |
|
|
'OUTPUT': outsource}, context, feedback), |
|
|
['gdal2xyz.py', |
|
|
'-band 1 ' + |
|
|
source + ' ' + |
|
|
outsource]) |
|
|
|
|
|
# csv output |
|
|
self.assertEqual( |
|
|
alg.getConsoleCommands({'INPUT': source, |
|
|
'BAND': 1, |
|
|
'CSV': True, |
|
|
'OUTPUT': outsource}, context, feedback), |
|
|
['gdal2xyz.py', |
|
|
'-band 1 -csv ' + |
|
|
source + ' ' + |
|
|
outsource]) |
|
|
|
|
|
|
|
|
class TestGdalOgrToPostGis(unittest.TestCase): |
|
|
|
|
|
|
@@ -168,20 +168,6 @@ tests: |
|
|
- 'Band 1 Block=373x5 Type=Float32, ColorInterp=Gray' |
|
|
- ' NoData Value=-99999' |
|
|
|
|
|
# Disabled as gdal2xyz.py is not available on Travis |
|
|
# - algorithm: gdal:gdal2xyz |
|
|
# name: gdal2xyz |
|
|
# params: |
|
|
# BAND: 1 |
|
|
# CSV: false |
|
|
# INPUT: |
|
|
# name: dem.tif |
|
|
# type: raster |
|
|
# results: |
|
|
# OUTPUT: |
|
|
# name: expected/gdal/xyz.csv |
|
|
# type: file |
|
|
|
|
|
- algorithm: gdal:tileindex |
|
|
name: Tile index (gdaltindex) |
|
|
params: |
|
|