Skip to content

Commit ec204c3

Browse files
committedNov 15, 2015
Create DTM2ASCII
new tool
1 parent e6d495a commit ec204c3

File tree

1 file changed

+63
-0
lines changed
  • python/plugins/processing/algs/lidar/fusion

1 file changed

+63
-0
lines changed
 
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
DTM2ASCII.py
6+
---------------------
7+
Date : May 2014
8+
Copyright : (C) 2014 by Niccolo' Marchi
9+
Email : sciurusurbanus at hotmail dot it
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = "Niccolo' Marchi"
21+
__date__ = 'May 2014'
22+
__copyright__ = "(C) 2014 by Niccolo' Marchi"
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
import os
29+
from processing.core.parameters import ParameterFile
30+
from processing.core.parameters import ParameterSelection
31+
from FusionAlgorithm import FusionAlgorithm
32+
from FusionUtils import FusionUtils
33+
34+
35+
class DTM2ASCII(FusionAlgorithm):
36+
37+
INPUT = 'INPUT'
38+
SWITCH = 'SWITCH'
39+
40+
41+
def defineCharacteristics(self):
42+
self.name, self.i18n_name = self.trAlgorithm('DTM to ASCII')
43+
self.group, self.i18n_group = self.trAlgorithm('Points')
44+
self.addParameter(ParameterFile(
45+
self.INPUT, self.tr('Input canopy surface (.dtm)')))
46+
self.addParameter(ParameterSelection(
47+
self.SWITCH, self.tr('Output format'), ['raster (ASCII)', 'csv']))
48+
49+
50+
def processAlgorithm(self, progress):
51+
commands = [os.path.join(FusionUtils.FusionPath(), 'DTM2ASCII.exe')]
52+
commands.append('/verbose')
53+
if self.getParameterValue(self.SWITCH) == 0:
54+
commands.append('/raster')
55+
else:
56+
commands.append('/csv')
57+
files = self.getParameterValue(self.INPUT).split(';')
58+
if len(files) == 1:
59+
commands.append(self.getParameterValue(self.INPUT))
60+
else:
61+
FusionUtils.createFileList(files)
62+
commands.append(FusionUtils.tempFileListFilepath())
63+
FusionUtils.runFusion(commands, progress)

0 commit comments

Comments
 (0)
Please sign in to comment.