Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[processing] more changes to fusion lidar algorithms
- Loading branch information
Showing
8 changed files
with
331 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
*************************************************************************** | ||
ASCII2DTM.py | ||
--------------------- | ||
Date : May 2014 | ||
Copyright : (C) 2014 by Niccolo' Marchi | ||
Email : sciurusurbanus at hotmail dot it | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
*************************************************************************** | ||
""" | ||
|
||
__author__ = "Niccolo' Marchi" | ||
__date__ = 'May 2014' | ||
__copyright__ = "(C) 2014 by Niccolo' Marchi" | ||
|
||
# This will get replaced with a git SHA1 when you do a git archive | ||
|
||
__revision__ = '$Format:%H$' | ||
|
||
import os | ||
import subprocess | ||
from processing.parameters.ParameterFile import ParameterFile | ||
from processing.parameters.ParameterSelection import ParameterSelection | ||
from processing.parameters.ParameterNumber import ParameterNumber | ||
from processing.outputs.OutputFile import OutputFile | ||
from FusionAlgorithm import FusionAlgorithm | ||
from FusionUtils import FusionUtils | ||
|
||
|
||
class ASCII2DTM(FusionAlgorithm): | ||
|
||
INPUT = 'INPUT' | ||
OUTPUT = 'OUTPUT' | ||
COORDSYS = 'COORDSYS' | ||
XYUNITS = 'XYUNITS' | ||
ZUNITS = 'ZUNITS' | ||
UNITS = ['Meter', 'Feet'] | ||
ZONE = 'ZONE' | ||
|
||
def defineCharacteristics(self): | ||
self.name = 'ASCII to DTM' | ||
self.group = 'Conversion' | ||
self.addParameter(ParameterFile(self.INPUT, 'Input ESRI ASCII layer')) | ||
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', | ||
self.UNITS)) | ||
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', | ||
self.UNITS)) | ||
self.addParameter(ParameterSelection(self.COORDSYS, 'Coordinate system', | ||
['unknown', 'UTM', 'state plane'])) | ||
self.addParameter(ParameterNumber(self.ZONE, "Coordinate system zone ('0' for unknown)", 0, None, | ||
0)) | ||
self.addOutput(OutputFile(self.OUTPUT, 'Output surface', 'dtm')) | ||
self.addAdvancedModifiers() | ||
|
||
def processAlgorithm(self, progress): | ||
commands = [os.path.join(FusionUtils.FusionPath(), 'ASCII2DTM.exe')] | ||
commands.append('/verbose') | ||
self.addAdvancedModifiersToCommand(commands) | ||
outFile = self.getOutputValue(self.OUTPUT) | ||
commands.append(outFile) | ||
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0]) | ||
commands.append(self.UNITS[self.getParameterValue(self.ZUNITS)][0]) | ||
commands.append(str(self.getParameterValue(self.COORDSYS))) | ||
commands.append(str(self.getParameterValue(self.ZONE))) | ||
commands.append('0') | ||
commands.append('0') | ||
files = self.getParameterValue(self.INPUT).split(';') | ||
if len(files) == 1: | ||
commands.append(self.getParameterValue(self.INPUT)) | ||
else: | ||
FusionUtils.createFileList(files) | ||
commands.append(FusionUtils.tempFileListFilepath()) | ||
FusionUtils.runFusion(commands, progress) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
*************************************************************************** | ||
DTM2TIF.py | ||
--------------------- | ||
Date : May 2014 | ||
Copyright : (C) 2014 by Niccolo' Marchi | ||
Email : sciurusurbanus at hotmail dot it | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
*************************************************************************** | ||
""" | ||
|
||
__author__ = "Niccolo' Marchi" | ||
__date__ = 'May 2014' | ||
__copyright__ = "(C) 2014 by Niccolo' Marchi" | ||
|
||
# This will get replaced with a git SHA1 when you do a git archive | ||
|
||
__revision__ = '$Format:%H$' | ||
|
||
import os | ||
from processing.parameters.ParameterFile import ParameterFile | ||
from processing.outputs.OutputRaster import OutputRaster | ||
from FusionAlgorithm import FusionAlgorithm | ||
from FusionUtils import FusionUtils | ||
|
||
|
||
class DTM2TIF(FusionAlgorithm): | ||
|
||
INPUT = "INPUT" | ||
OUTPUT = "OUTPUT" | ||
CSV = 'CSV' | ||
|
||
|
||
def defineCharacteristics(self): | ||
self.name = "DTM to TIF" | ||
self.group = "Conversion" | ||
self.addParameter(ParameterFile(self.INPUT, "Input .dtm layer")) | ||
self.addOutput(OutputRaster(self.OUTPUT, 'Output file name')) | ||
self.addAdvancedModifiers() | ||
|
||
def processAlgorithm(self, progress): | ||
commands = [os.path.join(FusionUtils.FusionPath(), "DTM2TIF.exe")] | ||
commands.append("/verbose") | ||
self.addAdvancedModifiersToCommand(commands) | ||
files = self.getParameterValue(self.INPUT).split(";") | ||
if len(files) == 1: | ||
commands.append(self.getParameterValue(self.INPUT)) | ||
else: | ||
FusionUtils.createFileList(files) | ||
commands.append(FusionUtils.tempFileListFilepath()) | ||
outFile = self.getOutputValue(self.OUTPUT) | ||
commands.append(outFile) | ||
|
||
FusionUtils.runFusion(commands, progress) |
65 changes: 65 additions & 0 deletions
65
python/plugins/processing/algs/lidar/fusion/FirstLastReturn.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
*************************************************************************** | ||
FirstLastReturn.py | ||
--------------------- | ||
Date : May 2014 | ||
Copyright : (C) 2014 by Niccolo' Marchi | ||
Email : sciurusurbanus at hotmail dot it | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
*************************************************************************** | ||
""" | ||
|
||
__author__ = "Niccolo' Marchi" | ||
__date__ = 'May 2014' | ||
__copyright__ = "(C) 2014 by Niccolo' Marchi" | ||
|
||
# This will get replaced with a git SHA1 when you do a git archive | ||
|
||
__revision__ = '$Format:%H$' | ||
|
||
import os | ||
from processing.parameters.ParameterFile import ParameterFile | ||
from processing.parameters.ParameterBoolean import ParameterBoolean | ||
from processing.outputs.OutputFile import OutputFile | ||
from FusionAlgorithm import FusionAlgorithm | ||
from FusionUtils import FusionUtils | ||
|
||
|
||
class FirstLastReturn(FusionAlgorithm): | ||
|
||
INPUT = 'INPUT' | ||
OUTPUT = 'OUTPUT' | ||
SWITCH = 'SWITCH' | ||
|
||
|
||
def defineCharacteristics(self): | ||
self.name = 'First&Last Return' | ||
self.group = 'Points' | ||
self.addParameter(ParameterFile(self.INPUT, 'Input .las')) | ||
self.addParameter(ParameterBoolean(self.SWITCH, 'Use LAS info', True)) | ||
self.addOutput(OutputFile(self.OUTPUT, 'Output layers')) | ||
self.addAdvancedModifiers() | ||
|
||
def processAlgorithm(self, progress): | ||
commands = [os.path.join(FusionUtils.FusionPath(), 'FirstLastReturn.exe')] | ||
commands.append('/verbose') | ||
if self.getParameterValue(self.SWITCH) == True: | ||
commands.append('/uselas') | ||
self.addAdvancedModifiersToCommand(commands) | ||
outFile = self.getOutputValue(self.OUTPUT) | ||
commands.append(outFile) | ||
files = self.getParameterValue(self.INPUT).split(';') | ||
if len(files) == 1: | ||
commands.append(self.getParameterValue(self.INPUT)) | ||
else: | ||
FusionUtils.createFileList(files) | ||
commands.append(FusionUtils.tempFileListFilepath()) | ||
FusionUtils.runFusion(commands, progress) |
Oops, something went wrong.