mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[processing] Update of fusion lidar algorithms (By Agresta S.Coop)
This commit is contained in:
parent
6bef78f49d
commit
9204ca02b6
@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
@ -11,6 +11,10 @@
|
||||
Date : April 2014
|
||||
Copyright : (C) 2014 by Martin Isenburg
|
||||
Email : martin near rapidlasso point com
|
||||
---------------------
|
||||
Date : June 2014
|
||||
Copyright : (C) 2014 by Agresta S. Coop
|
||||
Email : iescamochero at agresta dot org
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -88,11 +92,14 @@ from lastools.hugeFileNormalize import hugeFileNormalize
|
||||
from fusion.OpenViewerAction import OpenViewerAction
|
||||
from fusion.CanopyMaxima import CanopyMaxima
|
||||
from fusion.CanopyModel import CanopyModel
|
||||
from fusion.Catalog import Catalog
|
||||
from fusion.ClipData import ClipData
|
||||
from fusion.CloudMetrics import CloudMetrics
|
||||
from fusion.Cover import Cover
|
||||
from fusion.GridMetrics import GridMetrics
|
||||
from fusion.GridSurfaceCreate import GridSurfaceCreate
|
||||
from fusion.TinSurfaceCreate import TinSurfaceCreate
|
||||
from fusion.Csv2Grid import Csv2Grid
|
||||
from fusion.GroundFilter import GroundFilter
|
||||
from fusion.MergeData import MergeData
|
||||
from fusion.FilterData import FilterData
|
||||
@ -146,7 +153,8 @@ class LidarToolsAlgorithmProvider(AlgorithmProvider):
|
||||
|
||||
if isWindows():
|
||||
lastoolsPipe = [
|
||||
flightlinesToDTMandDSM(), flightlinesToCHM(), flightlinesToSingleCHMpitFree(), hugeFileClassify(), hugeFileGroundClassify(), hugeFileNormalize()
|
||||
flightlinesToDTMandDSM(), flightlinesToCHM(), flightlinesToSingleCHMpitFree(), hugeFileClassify(),
|
||||
hugeFileGroundClassify(), hugeFileNormalize()
|
||||
]
|
||||
else:
|
||||
lastoolsPipe = [
|
||||
@ -160,9 +168,9 @@ class LidarToolsAlgorithmProvider(AlgorithmProvider):
|
||||
if isWindows():
|
||||
self.actions.append(OpenViewerAction())
|
||||
fusiontools = [
|
||||
CloudMetrics(), CanopyMaxima(), CanopyModel(), ClipData(),
|
||||
Cover(), FilterData(), GridMetrics(), GroundFilter(),
|
||||
GridSurfaceCreate(), MergeData()
|
||||
Catalog(), CloudMetrics(), CanopyMaxima(), CanopyModel(), ClipData(),
|
||||
Csv2Grid(), Cover(), FilterData(), GridMetrics(), GroundFilter(),
|
||||
GridSurfaceCreate(), MergeData(), TinSurfaceCreate()
|
||||
]
|
||||
for alg in fusiontools:
|
||||
alg.group = 'Fusion'
|
||||
|
@ -26,9 +26,6 @@ __copyright__ = '(C) 2012, Victor Olaya'
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.parameters.ParameterFile import ParameterFile
|
||||
from processing.parameters.ParameterNumber import ParameterNumber
|
||||
from processing.outputs.OutputTable import OutputTable
|
||||
|
@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
@ -7,6 +7,10 @@
|
||||
Date : August 2012
|
||||
Copyright : (C) 2012 by Victor Olaya
|
||||
Email : volayaf at gmail dot com
|
||||
---------------------
|
||||
Date : June 2014
|
||||
Copyright : (C) 2014 by Agresta S. Coop.
|
||||
Email : iescamochero at agresta dot org
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -20,9 +24,7 @@
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
@ -30,7 +32,9 @@ import subprocess
|
||||
from processing.parameters.ParameterFile import ParameterFile
|
||||
from processing.parameters.ParameterNumber import ParameterNumber
|
||||
from processing.parameters.ParameterSelection import ParameterSelection
|
||||
from processing.outputs.OutputRaster import OutputRaster
|
||||
from processing.parameters.ParameterBoolean import ParameterBoolean
|
||||
from processing.parameters.ParameterString import ParameterString
|
||||
from processing.outputs.OutputFile import OutputFile
|
||||
from FusionAlgorithm import FusionAlgorithm
|
||||
from FusionUtils import FusionUtils
|
||||
|
||||
@ -38,37 +42,71 @@ from FusionUtils import FusionUtils
|
||||
class CanopyModel(FusionAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
OUTPUT = 'OUTPUT'
|
||||
CELLSIZE = 'CELLSIZE'
|
||||
GROUND = 'GROUND'
|
||||
OUTPUT_DTM = 'OUTPUT_DTM'
|
||||
OUTPUT_ASCII = 'OUTPUT_ASCII'
|
||||
CELLSIZE = 'CELLSIZE'
|
||||
XYUNITS = 'XYUNITS'
|
||||
ZUNITS = 'ZUNITS'
|
||||
UNITS = ['Meter', 'Feet']
|
||||
GROUND = 'GROUND'
|
||||
MEDIAN = 'MEDIAN'
|
||||
SMOOTH = 'SMOOTH'
|
||||
SLOPE = 'SLOPE'
|
||||
CLASS = 'CLASS'
|
||||
ASCII = 'ASCII'
|
||||
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
|
||||
|
||||
def defineCharacteristics(self):
|
||||
self.name = 'Canopy Model'
|
||||
self.group = 'Points'
|
||||
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
|
||||
self.addParameter(ParameterFile(self.GROUND,
|
||||
'Input ground DTM layer [optional, leave blank if not using it]'))
|
||||
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None,
|
||||
10.0))
|
||||
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units',
|
||||
self.UNITS))
|
||||
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units',
|
||||
self.UNITS))
|
||||
self.addOutput(OutputRaster(self.OUTPUT, 'Canopy model'))
|
||||
self.addAdvancedModifiers()
|
||||
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
|
||||
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None, 10.0))
|
||||
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
|
||||
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
|
||||
self.addParameter(ParameterBoolean(self.ASCII, 'ASCII Output?'))
|
||||
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
|
||||
self.addOutput(OutputFile(self.OUTPUT_ASCII, 'ASCII Output Surface', 'asc'))
|
||||
ground = ParameterFile(self.GROUND, 'Input ground DTM layer', False, True)
|
||||
ground.isAdvanced = True
|
||||
self.addParameter(ground)
|
||||
median = ParameterString(self.MEDIAN, 'Median (set blank if not used)', '', False, True)
|
||||
median.isAdvanced = True
|
||||
self.addParameter(median)
|
||||
smooth = ParameterString(self.SMOOTH, 'Smooth (set blank if not used)', '', False, True)
|
||||
smooth.isAdvanced = True
|
||||
self.addParameter(smooth)
|
||||
slope = ParameterString(self.SLOPE, 'Slope (set blank if not used)', '', False, True)
|
||||
slope.isAdvanced = True
|
||||
self.addParameter(slope)
|
||||
class_var = ParameterString(self.CLASS, 'Class (set blank if not used)', '', False, True)
|
||||
class_var.isAdvanced = True
|
||||
self.addParameter(class_var)
|
||||
advance_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
|
||||
advance_modifiers.isAdvanced = True
|
||||
self.addParameter(advance_modifiers)
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'CanopyModel.exe')]
|
||||
commands.append('/verbose')
|
||||
self.addAdvancedModifiersToCommand(commands)
|
||||
ground = self.getParameterValue(self.GROUND)
|
||||
if str(ground).strip() != '':
|
||||
commands.append('/ground:' + str(ground))
|
||||
outFile = self.getOutputValue(self.OUTPUT) + '.dtm'
|
||||
commands.append(outFile)
|
||||
median = self.getParameterValue(self.MEDIAN)
|
||||
if str(median).strip() != '':
|
||||
commands.append('/median:' + str(median))
|
||||
smooth = self.getParameterValue(self.SMOOTH)
|
||||
if str(smooth).strip() != '':
|
||||
commands.append('/smooth:' + str(smooth))
|
||||
slope = self.getParameterValue(self.SLOPE)
|
||||
if str(slope).strip() != '':
|
||||
commands.append('/slope:' + str(slope))
|
||||
class_var = self.getParameterValue(self.CLASS)
|
||||
if str(class_var).strip() != '':
|
||||
commands.append('/class:' + str(class_var))
|
||||
advance_modifiers = str(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
|
||||
if advance_modifiers != '':
|
||||
commands.append(s)
|
||||
commands.append(self.getOutputValue(self.OUTPUT_DTM))
|
||||
commands.append(str(self.getParameterValue(self.CELLSIZE)))
|
||||
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])
|
||||
commands.append(self.UNITS[self.getParameterValue(self.ZUNITS)][0])
|
||||
@ -83,8 +121,10 @@ class CanopyModel(FusionAlgorithm):
|
||||
FusionUtils.createFileList(files)
|
||||
commands.append(FusionUtils.tempFileListFilepath())
|
||||
FusionUtils.runFusion(commands, progress)
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'DTM2TIF.exe')]
|
||||
commands.append(outFile)
|
||||
commands.append(self.getOutputValue(self.OUTPUT))
|
||||
p = subprocess.Popen(commands, shell=True)
|
||||
p.wait()
|
||||
ascii = self.getParameterValue(self.ASCII)
|
||||
if ascii == 1:
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'DTM2ASCII.exe')]
|
||||
commands.append(self.getOutputValue(self.OUTPUT_DTM))
|
||||
commands.append(self.getOutputValue(self.OUTPUT_ASCII))
|
||||
p = subprocess.Popen(commands, shell=True)
|
||||
p.wait()
|
||||
|
84
python/plugins/processing/algs/lidar/fusion/Catalog.py
Normal file
84
python/plugins/processing/algs/lidar/fusion/Catalog.py
Normal file
@ -0,0 +1,84 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
Catalog.py
|
||||
---------------------
|
||||
Date : June 2014
|
||||
Copyright : (C) 2014 by Agresta S. Coop
|
||||
Email : iescamochero at agresta dot org
|
||||
***************************************************************************
|
||||
* *
|
||||
* 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__ = 'Agresta S. Coop - www.agresta.org'
|
||||
__date__ = 'June 2014'
|
||||
__copyright__ = '(C) 2014, Agresta S. Coop'
|
||||
# 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.ParameterString import ParameterString
|
||||
from processing.outputs.OutputFile import OutputFile
|
||||
from FusionUtils import FusionUtils
|
||||
from FusionAlgorithm import FusionAlgorithm
|
||||
|
||||
|
||||
class Catalog(FusionAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
OUTPUT = 'OUTPUT'
|
||||
DENSITY = 'DENSITY'
|
||||
FIRSTDENSITY = 'FIRSTDENSITY'
|
||||
INTENSITY = 'INTENSITY'
|
||||
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
|
||||
|
||||
def defineCharacteristics(self):
|
||||
self.name = 'Catalog'
|
||||
self.group = 'Points'
|
||||
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
|
||||
self.addOutput(OutputFile(self.OUTPUT, 'Output files'))
|
||||
density = ParameterString(self.DENSITY, 'Density - area, min, max (set blank if not used)', '', False, True)
|
||||
density.isAdvanced = True
|
||||
self.addParameter(density)
|
||||
firest_density = ParameterString(self.FIRSTDENSITY, 'First Density - area, min, max (set blank if not used)', '', False, True)
|
||||
firest_density.isAdvanced = True
|
||||
self.addParameter(firest_density)
|
||||
intensity = ParameterString(self.INTENSITY, 'Intensity - area, min, max (set blank if not used)', '', False, True)
|
||||
intensity.isAdvanced = True
|
||||
self.addParameter(intensity)
|
||||
advanced_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
|
||||
advanced_modifiers.isAdvanced = True
|
||||
self.addParameter(advanced_modifiers)
|
||||
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'Catalog.exe')]
|
||||
commands.append('/verbose')
|
||||
intensity = self.getParameterValue(self.INTENSITY)
|
||||
if str(intensity).strip():
|
||||
commands.append('/intensity:' + str(intensity))
|
||||
density = self.getParameterValue(self.DENSITY)
|
||||
if str(density).strip():
|
||||
commands.append('/density:' + str(density))
|
||||
firstdensity = self.getParameterValue(self.FIRSTDENSITY)
|
||||
if str(firstdensity).strip():
|
||||
commands.append('/firstdensity:' + str(firstdensity))
|
||||
advanced_modifiers = str(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
|
||||
if advanced_modifiers:
|
||||
commands.append(advanced_modifiers)
|
||||
files = self.getParameterValue(self.INPUT).split(';')
|
||||
if len(files) == 1:
|
||||
commands.append(self.getParameterValue(self.INPUT))
|
||||
else:
|
||||
FusionUtils.createFileList(files)
|
||||
commands.append(FusionUtils.tempFileListFilepath())
|
||||
commands.append(self.getOutputValue(self.OUTPUT))
|
||||
FusionUtils.runFusion(commands, progress)
|
@ -27,7 +27,6 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from PyQt4 import QtGui
|
||||
from processing.parameters.ParameterFile import ParameterFile
|
||||
from processing.parameters.ParameterExtent import ParameterExtent
|
||||
from processing.parameters.ParameterSelection import ParameterSelection
|
||||
|
@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
@ -7,6 +7,10 @@
|
||||
Date : August 2012
|
||||
Copyright : (C) 2012 by Victor Olaya
|
||||
Email : volayaf at gmail dot com
|
||||
---------------------
|
||||
Date : June 2014
|
||||
Copyright : (C) 2014 by Agresta S. Coop.
|
||||
Email : iescamochero at agresta dot org
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -20,35 +24,60 @@
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
# 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.OutputTable import OutputTable
|
||||
from processing.outputs.OutputFile import OutputFile
|
||||
from FusionUtils import FusionUtils
|
||||
from FusionAlgorithm import FusionAlgorithm
|
||||
from processing.parameters.ParameterString import ParameterString
|
||||
from processing.parameters.ParameterBoolean import ParameterBoolean
|
||||
|
||||
|
||||
class CloudMetrics(FusionAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
OUTPUT = 'OUTPUT'
|
||||
ABOVE = 'ABOVE'
|
||||
FIRSTIMPULSE = 'FIRSTIMPULSE'
|
||||
FIRSTRETURN = 'FIRSTRETURN'
|
||||
HTMIN = 'HTMIN'
|
||||
|
||||
def defineCharacteristics(self):
|
||||
self.name = 'Cloud Metrics'
|
||||
self.group = 'Points'
|
||||
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
|
||||
self.addOutput(OutputTable(self.OUTPUT,
|
||||
'Output file with tabular metric information'))
|
||||
self.addAdvancedModifiers()
|
||||
self.addOutput(OutputFile(self.OUTPUT, 'Output file with tabular metric information', 'dtm'))
|
||||
above = ParameterString(self.ABOVE, 'Above', '', False)
|
||||
above.isAdvanced = True
|
||||
self.addParameter(above)
|
||||
firstImpulse = ParameterBoolean(self.FIRSTIMPULSE, 'First Impulse', False)
|
||||
firstImpulse.isAdvanced = True
|
||||
self.addParameter(firstImpulse)
|
||||
firstReturn = ParameterBoolean(self.FIRSTRETURN, 'First Return', False)
|
||||
firstReturn.isAdvanced = True
|
||||
self.addParameter(firstReturn)
|
||||
htmin = ParameterString(self.HTMIN, 'Htmin', '', False, True)
|
||||
htmin.isAdvanced = True
|
||||
self.addParameter(htmin)
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'CloudMetrics.exe')]
|
||||
commands.append('/verbose')
|
||||
self.addAdvancedModifiersToCommand(commands)
|
||||
above = self.getParameterValue(self.ABOVE)
|
||||
if str(above).strip() != '':
|
||||
commands.append('/above:' + str(above))
|
||||
firstImpulse = self.getParameterValue(self.FIRSTIMPULSE)
|
||||
if firstImpulse:
|
||||
commands.append('/firstinpulse:' + firstImpulse)
|
||||
firstReturn = self.getParameterValue(self.FIRSTRETURN)
|
||||
if firstReturn:
|
||||
commands.append('/firstreturn:' + first_return)
|
||||
htmin = self.getParameterValue(self.HTMIN)
|
||||
if str(htmin).strip() != '':
|
||||
commands.append('/minht:' + str(htmin))
|
||||
files = self.getParameterValue(self.INPUT).split(';')
|
||||
if len(files) == 1:
|
||||
commands.append(self.getParameterValue(self.INPUT))
|
||||
@ -56,5 +85,4 @@ class CloudMetrics(FusionAlgorithm):
|
||||
FusionUtils.createFileList(files)
|
||||
commands.append(FusionUtils.tempFileListFilepath())
|
||||
commands.append(self.getOutputValue(self.OUTPUT))
|
||||
|
||||
FusionUtils.runFusion(commands, progress)
|
||||
|
@ -26,9 +26,7 @@ __copyright__ = '(C) 2012, Victor Olaya'
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
from PyQt4 import QtGui
|
||||
import subprocess
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.parameters.ParameterFile import ParameterFile
|
||||
from processing.parameters.ParameterNumber import ParameterNumber
|
||||
from processing.parameters.ParameterSelection import ParameterSelection
|
||||
|
59
python/plugins/processing/algs/lidar/fusion/Csv2Grid.py
Normal file
59
python/plugins/processing/algs/lidar/fusion/Csv2Grid.py
Normal file
@ -0,0 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
Csv2Grid.py
|
||||
---------------------
|
||||
Date : June 2014
|
||||
Copyright : (C) 2014 by Agresta S. Coop
|
||||
Email : iescamochero at agresta dot org
|
||||
***************************************************************************
|
||||
* *
|
||||
* 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__ = 'Agresta S. Coop - www.agresta.org'
|
||||
__date__ = 'June 2014'
|
||||
__copyright__ = '(C) 2014, Agresta S. Coop'
|
||||
# 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.ParameterString import ParameterString
|
||||
from processing.outputs.OutputFile import OutputFile
|
||||
from FusionAlgorithm import FusionAlgorithm
|
||||
from FusionUtils import FusionUtils
|
||||
|
||||
|
||||
class Csv2Grid(FusionAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
COLUMN = 'COLUMN'
|
||||
OUTPUT = 'OUTPUT'
|
||||
|
||||
def defineCharacteristics(self):
|
||||
self.name = 'Csv2Grid'
|
||||
self.group = 'Points'
|
||||
self.addParameter(ParameterFile(self.INPUT, 'CSV Files'))
|
||||
self.addParameter(ParameterString(self.COLUMN, 'Column'))
|
||||
self.addOutput(OutputFile(self.OUTPUT, 'Raster Output file', 'asc'))
|
||||
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'CSV2Grid.exe')]
|
||||
commands.append('/verbose')
|
||||
files = self.getParameterValue(self.INPUT).split(';')
|
||||
if len(files) == 1:
|
||||
commands.append(self.getParameterValue(self.INPUT))
|
||||
else:
|
||||
FusionUtils.createFileList(files)
|
||||
commands.append(FusionUtils.tempFileListFilepath())
|
||||
commands.append(self.getParameterValue(self.COLUMN))
|
||||
commands.append(self.getOutputValue(self.OUTPUT))
|
||||
FusionUtils.runFusion(commands, progress)
|
@ -1,26 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
DensityMetrics.py
|
||||
---------------------
|
||||
Date : August 2012
|
||||
Copyright : (C) 2012 by Victor Olaya
|
||||
Email : volayaf at gmail dot com
|
||||
***************************************************************************
|
||||
* *
|
||||
* 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__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
GridMetrics.py
|
||||
@ -7,6 +7,10 @@
|
||||
Date : August 2012
|
||||
Copyright : (C) 2012 by Victor Olaya
|
||||
Email : volayaf at gmail dot com
|
||||
---------------------
|
||||
Date : June 2014
|
||||
Copyright : (C) 2014 by Agresta S. Coop.
|
||||
Email : iescamochero at agresta dot org
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -20,15 +24,15 @@
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
# 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.ParameterNumber import ParameterNumber
|
||||
from processing.outputs.OutputTable import OutputTable
|
||||
from processing.parameters.ParameterBoolean import ParameterBoolean
|
||||
from processing.parameters.ParameterString import ParameterString
|
||||
from processing.outputs.OutputFile import OutputFile
|
||||
from FusionUtils import FusionUtils
|
||||
from FusionAlgorithm import FusionAlgorithm
|
||||
|
||||
@ -36,10 +40,17 @@ from FusionAlgorithm import FusionAlgorithm
|
||||
class GridMetrics(FusionAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
OUTPUT = 'OUTPUT'
|
||||
OUTPUT_CSV_ELEVATION = 'OUTPUT_CSV_ELEVATION'
|
||||
OUTPUT_CSV_INTENSITY = 'OUTPUT_CSV_INTENSITY'
|
||||
OUTPUT_TXT_ELEVATION = 'OUTPUT_TXT_ELEVATION'
|
||||
OUTPUT_TXT_INTENSITY = 'OUTPUT_TXT_INTENSITY'
|
||||
GROUND = 'GROUND'
|
||||
HEIGHT = 'HEIGHT'
|
||||
CELLSIZE = 'CELLSIZE'
|
||||
OUTLIER = 'OUTLIER'
|
||||
FIRST = 'FIRST'
|
||||
MINHT = 'MINHT'
|
||||
CLASS = 'CLASS'
|
||||
|
||||
def defineCharacteristics(self):
|
||||
self.name = 'Grid Metrics'
|
||||
@ -48,23 +59,64 @@ class GridMetrics(FusionAlgorithm):
|
||||
self.addParameter(ParameterFile(self.GROUND, 'Input ground DTM layer'))
|
||||
self.addParameter(ParameterNumber(self.HEIGHT, 'Height break'))
|
||||
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize'))
|
||||
self.addOutput(OutputTable(self.OUTPUT,
|
||||
'Output table with grid metrics'))
|
||||
self.addAdvancedModifiers()
|
||||
|
||||
self.addOutput(OutputFile(self.OUTPUT_CSV_ELEVATION, 'Output table with grid metrics'))
|
||||
|
||||
output_csv_intensity = OutputFile(self.OUTPUT_CSV_INTENSITY, 'OUTPUT CSV INTENSITY')
|
||||
output_csv_intensity.hidden = True
|
||||
self.addOutput(output_csv_intensity)
|
||||
|
||||
output_txt_elevation = OutputFile(self.OUTPUT_TXT_ELEVATION, 'OUTPUT CSV INTENSITY')
|
||||
output_txt_elevation.hidden = True
|
||||
self.addOutput(output_txt_elevation)
|
||||
|
||||
output_txt_intensity = OutputFile(self.OUTPUT_TXT_INTENSITY, 'OUTPUT CSV INTENSITY')
|
||||
output_txt_intensity.hidden = True
|
||||
self.addOutput(output_txt_intensity)
|
||||
|
||||
outlier = ParameterString(self.OUTLIER, 'Outlier:low,high', '', False, True)
|
||||
outlier.isAdvanced = True
|
||||
self.addParameter(outlier)
|
||||
first = ParameterBoolean(self.FIRST, 'First', False)
|
||||
first.isAdvanced = True
|
||||
self.addParameter(first)
|
||||
minht = ParameterString(self.MINHT, 'Htmin', '', False, True)
|
||||
minht.isAdvanced = True
|
||||
self.addParameter(minht)
|
||||
class_var = ParameterString(self.CLASS, 'Class (set blank if not used)', '', False, True)
|
||||
class_var.isAdvanced = True
|
||||
self.addParameter(class_var)
|
||||
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'GridMetrics.exe')]
|
||||
commands.append('/verbose')
|
||||
self.addAdvancedModifiersToCommand(commands)
|
||||
outlier = self.getParameterValue(self.OUTLIER)
|
||||
if str(outlier).strip() != '':
|
||||
commands.append('/outlier:' + str(outlier))
|
||||
first = self.getParameterValue(self.FIRST)
|
||||
if first:
|
||||
commands.append('/first:' + str(first))
|
||||
minht = self.getParameterValue(self.MINHT)
|
||||
if str(minht).strip() != '':
|
||||
commands.append('/minht:' + str(minht))
|
||||
class_var = self.getParameterValue(self.CLASS)
|
||||
if str(class_var).strip() != '':
|
||||
commands.append('/class:' + str(class_var))
|
||||
commands.append(self.getParameterValue(self.GROUND))
|
||||
commands.append(str(self.getParameterValue(self.HEIGHT)))
|
||||
commands.append(str(self.getParameterValue(self.CELLSIZE)))
|
||||
commands.append(self.getOutputValue(self.OUTPUT))
|
||||
commands.append(self.getOutputValue(self.OUTPUT_CSV_ELEVATION))
|
||||
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)
|
||||
basePath = self.getOutputValue(self.OUTPUT_CSV_ELEVATION)
|
||||
basePath = os.path.join(os.path.dirname(basePath), os.path.splitext(os.path.basename(basePath))[0])
|
||||
self.setOutputValue(self.OUTPUT_CSV_ELEVATION, basePath + '_all_returns_elevation_stats.csv')
|
||||
self.setOutputValue(self.OUTPUT_CSV_INTENSITY, basePath + '_all_returns_intensity_stats.csv')
|
||||
self.setOutputValue(self.OUTPUT_TXT_ELEVATION, basePath + '_all_returns_elevation_stats_ascii_header.txt')
|
||||
self.setOutputValue(self.OUTPUT_TXT_INTENSITY, basePath + '_all_returns_intensity_stats_ascii_header.txt')
|
||||
|
@ -7,6 +7,10 @@
|
||||
Date : August 2012
|
||||
Copyright : (C) 2012 by Victor Olaya
|
||||
Email : volayaf at gmail dot com
|
||||
---------------------
|
||||
Date : June 2014
|
||||
Copyright : (C) 2014 by Agresta S. Coop.
|
||||
Email : iescamochero at agresta dot org
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -20,48 +24,96 @@
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
# 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.ParameterNumber import ParameterNumber
|
||||
from processing.parameters.ParameterBoolean import ParameterBoolean
|
||||
from processing.parameters.ParameterSelection import ParameterSelection
|
||||
from processing.outputs.OutputFile import OutputFile
|
||||
from FusionAlgorithm import FusionAlgorithm
|
||||
from FusionUtils import FusionUtils
|
||||
from processing.parameters.ParameterString import ParameterString
|
||||
|
||||
|
||||
class GridSurfaceCreate(FusionAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
OUTPUT = 'OUTPUT'
|
||||
OUTPUT_DTM = 'OUTPUT_DTM'
|
||||
OUTPUT_ASCII = 'OUTPUT_ASCII'
|
||||
CELLSIZE = 'CELLSIZE'
|
||||
XYUNITS = 'XYUNITS'
|
||||
ZUNITS = 'ZUNITS'
|
||||
UNITS = ['Meter', 'Feet']
|
||||
SPIKE = 'SPIKE'
|
||||
MEDIAN = 'MEDIAN'
|
||||
SMOOTH = 'SMOOTH'
|
||||
SLOPE = 'SLOPE'
|
||||
MINIMUM = 'MINIMUM'
|
||||
CLASS = 'CLASS'
|
||||
ASCII = 'ASCII'
|
||||
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
|
||||
|
||||
def defineCharacteristics(self):
|
||||
self.name = 'Create Grid Surface'
|
||||
self.name = 'Grid Surface Create'
|
||||
self.group = 'Surface'
|
||||
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
|
||||
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None,
|
||||
10.0))
|
||||
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units',
|
||||
self.UNITS))
|
||||
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units',
|
||||
self.UNITS))
|
||||
self.addOutput(OutputFile(self.OUTPUT, 'PLANS DTM surface'))
|
||||
self.addAdvancedModifiers()
|
||||
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None, 10.0))
|
||||
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
|
||||
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
|
||||
self.addParameter(ParameterBoolean(self.ASCII, 'ASCII Output?'))
|
||||
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
|
||||
self.addOutput(OutputFile(self.OUTPUT_ASCII, 'ASCII Output Surface', 'asc'))
|
||||
spike = ParameterString(self.SPIKE, 'Spike (set blank if not used)', '', False, True)
|
||||
spike.isAdvanced = True
|
||||
self.addParameter(spike)
|
||||
median = ParameterString(self.MEDIAN, 'Median (set blank if not used)', '', False, True)
|
||||
median.isAdvanced = True
|
||||
self.addParameter(median)
|
||||
smooth = ParameterString(self.SMOOTH, 'Smooth (set blank if not used)', '', False, True)
|
||||
smooth.isAdvanced = True
|
||||
self.addParameter(smooth)
|
||||
slope = ParameterString(self.SLOPE, 'Slope (set blank if not used)', '', False, True)
|
||||
slope.isAdvanced = True
|
||||
self.addParameter(slope)
|
||||
minimum = ParameterBoolean(self.MINIMUM, 'Minimum (set blank if not used)', False)
|
||||
minimum.isAdvanced = True
|
||||
self.addParameter(minimum)
|
||||
class_var = ParameterString(self.CLASS, 'Class - If multiple, separated by comma (set blank if not used)', 2, False, True)
|
||||
class_var.isAdvanced = True
|
||||
self.addParameter(class_var)
|
||||
advance_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
|
||||
advance_modifiers.isAdvanced = True
|
||||
self.addParameter(advance_modifiers)
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(FusionUtils.FusionPath(),
|
||||
'GridSurfaceCreate.exe')]
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'GridSurfaceCreate.exe')]
|
||||
commands.append('/verbose')
|
||||
self.addAdvancedModifiersToCommand(commands)
|
||||
commands.append(self.getOutputValue(self.OUTPUT))
|
||||
spike = self.getParameterValue(self.SPIKE)
|
||||
if str(spike).strip():
|
||||
commands.append('/spike:' + str(spike))
|
||||
median = self.getParameterValue(self.MEDIAN)
|
||||
if str(median).strip():
|
||||
commands.append('/median:' + str(median))
|
||||
smooth = self.getParameterValue(self.SMOOTH)
|
||||
if str(smooth).strip():
|
||||
commands.append('/smooth:' + str(smooth))
|
||||
slope = self.getParameterValue(self.SLOPE)
|
||||
if str(slope).strip():
|
||||
commands.append('/slope:' + str(slope))
|
||||
minimum = self.getParameterValue(self.MINIMUM)
|
||||
if str(minimum).strip():
|
||||
commands.append('/minimum:' + str(minimum))
|
||||
class_var = self.getParameterValue(self.CLASS)
|
||||
if str(class_var).strip():
|
||||
commands.append('/class:' + str(class_var))
|
||||
advance_modifiers = str(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
|
||||
if advance_modifiers:
|
||||
commands.append(s)
|
||||
commands.append(self.getOutputValue(self.OUTPUT_DTM))
|
||||
commands.append(str(self.getParameterValue(self.CELLSIZE)))
|
||||
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])
|
||||
commands.append(self.UNITS[self.getParameterValue(self.ZUNITS)][0])
|
||||
@ -74,5 +126,12 @@ class GridSurfaceCreate(FusionAlgorithm):
|
||||
commands.append(self.getParameterValue(self.INPUT))
|
||||
else:
|
||||
FusionUtils.createFileList(files)
|
||||
commands.append(FusionUtils.tempFileListFilepath())
|
||||
commands.append(FusionUtils.tempFileListFilepath())
|
||||
FusionUtils.runFusion(commands, progress)
|
||||
ascii = self.getParameterValue(self.ASCII)
|
||||
if ascii == 1:
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'DTM2ASCII.exe')]
|
||||
commands.append(self.getOutputValue(self.OUTPUT_DTM))
|
||||
commands.append(self.getOutputValue(self.OUTPUT_ASCII))
|
||||
p = subprocess.Popen(commands, shell=True)
|
||||
p.wait()
|
@ -0,0 +1,91 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
Catalog.py
|
||||
---------------------
|
||||
Date : June 2014
|
||||
Copyright : (C) 2014 by Agresta S. Coop
|
||||
Email : iescamochero at agresta dot org
|
||||
***************************************************************************
|
||||
* *
|
||||
* 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__ = 'Agresta S. Coop - www.agresta.org'
|
||||
__date__ = 'June 2014'
|
||||
__copyright__ = '(C) 2014, Agresta S. Coop'
|
||||
# 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.ParameterNumber import ParameterNumber
|
||||
from processing.parameters.ParameterBoolean import ParameterBoolean
|
||||
from processing.parameters.ParameterSelection import ParameterSelection
|
||||
from processing.outputs.OutputFile import OutputFile
|
||||
from FusionAlgorithm import FusionAlgorithm
|
||||
from FusionUtils import FusionUtils
|
||||
from processing.parameters.ParameterString import ParameterString
|
||||
|
||||
|
||||
class TinSurfaceCreate(FusionAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
OUTPUT_DTM = 'OUTPUT_DTM';
|
||||
OUTPUT_ASCII = 'OUTPUT_ASCII';
|
||||
CELLSIZE = 'CELLSIZE'
|
||||
XYUNITS = 'XYUNITS'
|
||||
ZUNITS = 'ZUNITS'
|
||||
UNITS = ['Meter', 'Feet']
|
||||
CLASS = 'CLASS'
|
||||
ASCII = 'ASCII'
|
||||
|
||||
def defineCharacteristics(self):
|
||||
self.name = 'Tin Surface Create'
|
||||
self.group = 'Surface'
|
||||
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
|
||||
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None, 10.0))
|
||||
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
|
||||
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
|
||||
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
|
||||
self.addOutput(OutputFile(self.OUTPUT_ASCII, 'ASCII Output Surface', 'asc'))
|
||||
self.addParameter(ParameterBoolean(self.ASCII, 'ASCII Output?'))
|
||||
class_var = ParameterString(self.CLASS, 'Class(set blank if not used)', 2, False, True)
|
||||
class_var.isAdvanced = True
|
||||
self.addParameter(class_var)
|
||||
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'TINSurfaceCreate.exe')]
|
||||
commands.append('/verbose')
|
||||
class_var = self.getParameterValue(self.CLASS)
|
||||
if str(class_var).strip() != '':
|
||||
commands.append('/class:' + str(class_var))
|
||||
commands.append(self.getOutputValue(self.OUTPUT_DTM))
|
||||
commands.append(str(self.getParameterValue(self.CELLSIZE)))
|
||||
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])
|
||||
commands.append(self.UNITS[self.getParameterValue(self.ZUNITS)][0])
|
||||
commands.append('0')
|
||||
commands.append('0')
|
||||
commands.append('0')
|
||||
commands.append('0')
|
||||
files = self.getParameterValue(self.INPUT).split(';')
|
||||
if len(files) == 1:
|
||||
commands.append(self.getParameterValue(self.INPUT))
|
||||
else:
|
||||
commands.extend(files)
|
||||
FusionUtils.runFusion(commands, progress)
|
||||
ascii = self.getParameterValue(self.ASCII)
|
||||
if ascii == 1:
|
||||
commands = [os.path.join(FusionUtils.FusionPath(), 'DTM2ASCII.exe')]
|
||||
commands.append(self.getOutputValue(self.OUTPUT_DTM))
|
||||
commands.append(self.getOutputValue(self.OUTPUT_ASCII))
|
||||
p = subprocess.Popen(commands, shell=True)
|
||||
p.wait()
|
Loading…
x
Reference in New Issue
Block a user