286 changes: 257 additions & 29 deletions python/plugins/processing/lidar/lastools/LasToolsAlgorithm.py

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions python/plugins/processing/lidar/lastools/LasToolsUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""
***************************************************************************
LasToolsUtils.py
LAStoolsUtils.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Expand All @@ -29,24 +29,24 @@
from processing.core.ProcessingLog import ProcessingLog
from processing.core.ProcessingConfig import ProcessingConfig

class LasToolsUtils():
class LAStoolsUtils():

LASTOOLS_FOLDER = "LASTOOLS_FOLDER"

@staticmethod
def LasToolsPath():
folder = ProcessingConfig.getSetting(LasToolsUtils.LASTOOLS_FOLDER)
def LAStoolsPath():
folder = ProcessingConfig.getSetting(LAStoolsUtils.LASTOOLS_FOLDER)
if folder == None:
folder =""

return folder

@staticmethod
def runLasTools(commands, progress):
def runLAStools(commands, progress):
loglines = []
loglines.append("LasTools execution console output")
loglines.append("LAStools console output")
commandline = " ".join(commands)
proc = subprocess.Popen(commandline, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE,stderr=subprocess.STDOUT, universal_newlines=False).stdout
for line in iter(proc.readline, ""):
loglines.append(line)
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
69 changes: 69 additions & 0 deletions python/plugins/processing/lidar/lastools/blast2dem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
blast2dem.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from PyQt4 import QtGui

from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterSelection import ParameterSelection

class blast2dem(LAStoolsAlgorithm):

ATTRIBUTE = "ATTRIBUTE"
PRODUCT = "PRODUCT"
ATTRIBUTES = ["elevation", "slope", "intensity", "rgb"]
PRODUCTS = ["actual values", "hillshade", "gray", "false"]


def defineCharacteristics(self):
self.name = "blast2dem"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersFilter1ReturnClassFlagsGUI()
self.addParametersStepGUI()
self.addParameter(ParameterSelection(blast2dem.ATTRIBUTE, "Attribute", blast2dem.ATTRIBUTES, 0))
self.addParameter(ParameterSelection(blast2dem.PRODUCT, "Product", blast2dem.PRODUCTS, 0))
self.addParametersRasterOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "blast2dem.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
self.addParametersStepCommands(commands)
attribute = self.getParameterValue(blast2dem.ATTRIBUTE)
if attribute != 0:
commands.append("-" + blast2dem.ATTRIBUTES[attribute])
product = self.getParameterValue(blast2dem.PRODUCT)
if product != 0:
commands.append("-" + blast2dem.PRODUCTS[product])
self.addParametersRasterOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
76 changes: 76 additions & 0 deletions python/plugins/processing/lidar/lastools/blast2iso.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
blast2iso.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterNumber import ParameterNumber

class blast2iso(LAStoolsAlgorithm):

SMOOTH = "SMOOTH"
ISO_EVERY = "ISO_EVERY"
SIMPLIFY_LENGTH = "SIMPLIFY_LENGTH"
SIMPLIFY_AREA = "SIMPLIFY_AREA"
CLEAN = "CLEAN"

def defineCharacteristics(self):
self.name = "blast2iso"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterNumber(blast2iso.SMOOTH, "smooth underlying TIN", 0, None, 0))
self.addParameter(ParameterNumber(blast2iso.ISO_EVERY, "extract isoline with a spacing of", 0, None, 10.0))
self.addParameter(ParameterNumber(blast2iso.CLEAN, "clean isolines shorter than (0 = do not clean)", None, None, 0.0))
self.addParameter(ParameterNumber(blast2iso.SIMPLIFY_LENGTH, "simplify segments shorter than (0 = do not simplify)", None, None, 0.0))
self.addParameter(ParameterNumber(blast2iso.SIMPLIFY_AREA, "simplify segments pairs with area less than (0 = do not simplify)", None, None, 0.0))
self.addParametersVectorOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "blast2iso.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
smooth = self.getParameterValue(blast2iso.SMOOTH)
if smooth != 0:
commands.append("-smooth")
commands.append(str(smooth))
commands.append("-iso_every")
commands.append(str(self.getParameterValue(blast2iso.ISO_EVERY)))
simplify_length = self.getParameterValue(blast2iso.SIMPLIFY_LENGTH)
if simplify_length != 0:
commands.append("-simplify_length")
commands.append(str(simplify_length))
simplify_area = self.getParameterValue(blast2iso.SIMPLIFY_AREA)
if simplify_area != 0:
commands.append("-simplify_area")
commands.append(str(simplify_area))
clean = self.getParameterValue(blast2iso.CLEAN)
if clean != 0:
commands.append("-clean")
commands.append(str(clean))
self.addParametersVectorOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
60 changes: 37 additions & 23 deletions python/plugins/processing/lidar/lastools/las2dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -25,35 +29,45 @@

import os
from PyQt4 import QtGui

from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterString import ParameterString
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.outputs.OutputRaster import OutputRaster
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.parameters.ParameterSelection import ParameterSelection

class las2dem(LasToolsAlgorithm):
class las2dem(LAStoolsAlgorithm):

ATTRIBUTE = "ATTRIBUTE"
PRODUCT = "PRODUCT"
ATTRIBUTES = ["elevation", "slope", "intensity", "rgb"]
PRODUCTS = ["actual values", "hillshade", "gray", "false"]

INPUT = "INPUT"
OUTPUT = "OUTPUT"
INTENSITY = "INTENSITY"

def defineCharacteristics(self):
self.name = "las2dem"
self.group = "Tools"
self.addParameter(ParameterFile(las2dem.INPUT, "Input las layer"))
self.addParameter(ParameterBoolean(las2dem.INTENSITY, "Use intensity instead of elevation", False))
self.addOutput(OutputRaster(las2dem.OUTPUT, "Output dem layer"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersFilter1ReturnClassFlagsGUI()
self.addParametersStepGUI()
self.addParameter(ParameterSelection(las2dem.ATTRIBUTE, "Attribute", las2dem.ATTRIBUTES, 0))
self.addParameter(ParameterSelection(las2dem.PRODUCT, "Product", las2dem.PRODUCTS, 0))
self.addParametersRasterOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "las2dem.exe")]
commands.append("-i")
commands.append(self.getParameterValue(las2dem.INPUT))
commands.append("-o")
commands.append(self.getOutputValue(las2dem.OUTPUT))
if self.getParameterValue(las2dem.INTENSITY):
commands.append("-intensity")
self.addCommonParameterValuesToCommand(commands)

LasToolsUtils.runLasTools(commands, progress)
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2dem.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
self.addParametersStepCommands(commands)
attribute = self.getParameterValue(las2dem.ATTRIBUTE)
if attribute != 0:
commands.append("-" + las2dem.ATTRIBUTES[attribute])
product = self.getParameterValue(las2dem.PRODUCT)
if product != 0:
commands.append("-" + las2dem.PRODUCTS[product])
self.addParametersRasterOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
67 changes: 39 additions & 28 deletions python/plugins/processing/lidar/lastools/las2iso.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -24,46 +28,53 @@
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterNumber import ParameterNumber
from processing.outputs.OutputVector import OutputVector
from processing.parameters.ParameterFile import ParameterFile

class las2iso(LasToolsAlgorithm):
class las2iso(LAStoolsAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"
SMOOTH = "SMOOTH"
ISO_EVERY = "ISO_EVERY"
SIMPLIFY_LENGTH = "SIMPLIFY_LENGTH"
SIMPLIFY_AREA = "SIMPLIFY_AREA"
CLEAN = "CLEAN"
SIMPLIFY = "SIMPLIFY"
INTERVAL = "INTERVAL"

def defineCharacteristics(self):
self.name = "las2iso"
self.group = "Tools"
self.addParameter(ParameterFile(las2iso.INPUT, "Input las layer"))
self.addParameter(ParameterNumber(las2iso.INTERVAL, "Interval between isolines", 0, None, 10.0))
self.addParameter(ParameterNumber(las2iso.CLEAN, "Clean isolines shorter than (0 = do not clean)", None, None, 0.0))
self.addParameter(ParameterNumber(las2iso.SIMPLIFY, "simplify segments shorter than (0 = do not simplify)", None, None, 0.0))
self.addOutput(OutputVector(las2iso.OUTPUT, "Output isolines"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterNumber(las2iso.SMOOTH, "smooth underlying TIN", 0, None, 0))
self.addParameter(ParameterNumber(las2iso.ISO_EVERY, "extract isoline with a spacing of", 0, None, 10.0))
self.addParameter(ParameterNumber(las2iso.CLEAN, "clean isolines shorter than (0 = do not clean)", None, None, 0.0))
self.addParameter(ParameterNumber(las2iso.SIMPLIFY_LENGTH, "simplify segments shorter than (0 = do not simplify)", None, None, 0.0))
self.addParameter(ParameterNumber(las2iso.SIMPLIFY_AREA, "simplify segments pairs with area less than (0 = do not simplify)", None, None, 0.0))
self.addParametersVectorOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "las2iso.exe")]
commands.append("-i")
commands.append(self.getParameterValue(las2iso.INPUT))
commands.append("-o")
commands.append(self.getOutputValue(las2iso.OUTPUT))
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2iso.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
smooth = self.getParameterValue(las2iso.SMOOTH)
if smooth != 0:
commands.append("-smooth")
commands.append(str(smooth))
commands.append("-iso_every")
commands.append(str(self.getParameterValue(las2iso.INTERVAL)))
simplify = self.getParameterValue(las2iso.SIMPLIFY)
if simplify != 0:
commands.append("-simplify")
commands.append(str(simplify))
commands.append(str(self.getParameterValue(las2iso.ISO_EVERY)))
simplify_length = self.getParameterValue(las2iso.SIMPLIFY_LENGTH)
if simplify_length != 0:
commands.append("-simplify_length")
commands.append(str(simplify_length))
simplify_area = self.getParameterValue(las2iso.SIMPLIFY_AREA)
if simplify_area != 0:
commands.append("-simplify_area")
commands.append(str(simplify_area))
clean = self.getParameterValue(las2iso.CLEAN)
if clean != 0:
commands.append("-clean")
commands.append(str(clean))
self.addCommonParameterValuesToCommand(commands)
self.addParametersVectorOutputCommands(commands)

LasToolsUtils.runLasTools(commands, progress)
LAStoolsUtils.runLAStools(commands, progress)
68 changes: 68 additions & 0 deletions python/plugins/processing/lidar/lastools/las2las.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
las2las.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterSelection import ParameterSelection

class las2las(LAStoolsAlgorithm):

STEP = "STEP"
OPERATION = "OPERATION"
OPERATIONS = ["---", "set_point_type", "set_point_size", "set_version_minor", "set_version_major", "start_at_point", "stop_at_point", "remove_vlr", "auto_reoffset", "week_to_adjusted", "adjusted_to_week", "scale_rgb_up", "scale_rgb_down", "remove_all_vlrs", "remove_extra", "clip_to_bounding_box"]
OPERATIONARG = "OPERATIONARG"

def defineCharacteristics(self):
self.name = "las2las"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersFilter1ReturnClassFlagsGUI()
self.addParametersFilter1CoordsIntensityGUI()
self.addParameter(ParameterSelection(las2las.OPERATION, "operations (first 7 need an argument)", las2las.OPERATIONS, 0))
self.addParameter(ParameterString(las2las.OPERATIONARG, "argument for operation"))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
self.addParametersFilter1CoordsIntensityCommands(commands)
operation = self.getParameterValue(las2las.OPERATION)
if operation != 0:
commands.append("-" + OPERATIONS[operation])
if operation > 7:
commands.append(self.getParameterValue(las2las.OPERATIONARG))

self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
60 changes: 60 additions & 0 deletions python/plugins/processing/lidar/lastools/las2las_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
las2las_filter.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterSelection import ParameterSelection

class las2las_filter(LAStoolsAlgorithm):

def defineCharacteristics(self):
self.name = "las2las_filter"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersFilter1ReturnClassFlagsGUI()
self.addParametersFilter2ReturnClassFlagsGUI()
self.addParametersFilter1CoordsIntensityGUI()
self.addParametersFilter2CoordsIntensityGUI()
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
self.addParametersFilter2ReturnClassFlagsCommands(commands)
self.addParametersFilter1CoordsIntensityCommands(commands)
self.addParametersFilter2CoordsIntensityCommands(commands)

self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
72 changes: 72 additions & 0 deletions python/plugins/processing/lidar/lastools/las2las_transform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
las2las_transform.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterSelection import ParameterSelection

class las2las_transform(LAStoolsAlgorithm):

STEP = "STEP"
OPERATION = "OPERATION"
OPERATIONS = ["---", "set_point_type", "set_point_size", "set_version_minor", "set_version_major", "start_at_point", "stop_at_point", "remove_vlr", "auto_reoffset", "week_to_adjusted", "adjusted_to_week", "scale_rgb_up", "scale_rgb_down", "remove_all_vlrs", "remove_extra", "clip_to_bounding_box"]
OPERATIONARG = "OPERATIONARG"

def defineCharacteristics(self):
self.name = "las2las_transform"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersTransform1CoordinateGUI()
self.addParametersTransform2CoordinateGUI()
self.addParametersTransform1OtherGUI()
self.addParametersTransform2OtherGUI()
self.addParameter(ParameterSelection(las2las_transform.OPERATION, "operations (first 7 need an argument)", las2las_transform.OPERATIONS, 0))
self.addParameter(ParameterString(las2las_transform.OPERATIONARG, "argument for operation"))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersTransform1CoordinateCommands(commands)
self.addParametersTransform2CoordinateCommands(commands)
self.addParametersTransform1OtherCommands(commands)
self.addParametersTransform2OtherCommands(commands)
operation = self.getParameterValue(las2las_transform.OPERATION)
if operation != 0:
commands.append("-" + las2las_transform.OPERATIONS[operation])
if operation > 7:
commands.append(self.getParameterValue(las2las_transform.OPERATIONARG))

self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
53 changes: 31 additions & 22 deletions python/plugins/processing/lidar/lastools/las2shp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
***************************************************************************
las2shp.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -17,37 +17,46 @@
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
__author__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.outputs.OutputVector import OutputVector
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

class las2shp(LasToolsAlgorithm):
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.outputs.OutputFile import OutputFile

INPUT = "INPUT"
class las2shp(LAStoolsAlgorithm):

POINT_Z = "POINT_Z"
RECORD_SIZE = "RECORD_SIZE"
OUTPUT = "OUTPUT"

def defineCharacteristics(self):
self.name = "las2shp"
self.group = "Tools"
self.addParameter(ParameterFile(las2shp.INPUT, "Input las layer"))
self.addOutput(OutputVector(las2shp.OUTPUT, "Output shp layer"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterBoolean(las2shp.POINT_Z, "use PointZ instead of MultiPointZ", False))
self.addParameter(ParameterNumber(las2shp.RECORD_SIZE, "number of points per record", 0, None, 1024))
self.addOutput(OutputFile(las2shp.OUTPUT, "Output SHP file"))

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "las2shp.exe")]
commands.append("-i")
commands.append(self.getParameterValue(las2shp.INPUT))
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2shp.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
if self.getParameterValue(las2shp.POINT_Z):
commands.append("-single_points")
record_size = self.getParameterValue(las2shp.RECORD_SIZE)
if record_size != 1024:
commands.append("-record_size")
commands.append(str(record_size))
commands.append("-o")
commands.append(self.getOutputValue(las2shp.OUTPUT))
self.addCommonParameterValuesToCommand(commands)


LasToolsUtils.runLasTools(commands, progress)
LAStoolsUtils.runLAStools(commands, progress)
58 changes: 58 additions & 0 deletions python/plugins/processing/lidar/lastools/las2txt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
las2txt.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterString import ParameterString
from processing.outputs.OutputFile import OutputFile

class las2txt(LAStoolsAlgorithm):

PARSE_STRING = "PARSE_STRING"
OUTPUT = "OUTPUT"

def defineCharacteristics(self):
self.name = "las2txt"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterString(las2txt.PARSE_STRING, "parse_string", "xyz"))
self.addOutput(OutputFile(las2txt.OUTPUT, "Output ASCII file"))

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2txt.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
parse_string = self.getParameterValue(las2txt.PARSE_STRING)
if parse_string != "xyz":
commands.append("-parse_string")
commands.append(parse_string)
commands.append("-o")
commands.append(self.getOutputValue(las2txt.OUTPUT))

LAStoolsUtils.runLAStools(commands, progress)
49 changes: 25 additions & 24 deletions python/plugins/processing/lidar/lastools/lasboundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -25,45 +29,42 @@

import os
from PyQt4 import QtGui
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.parameters.ParameterString import ParameterString
from processing.outputs.OutputVector import OutputVector
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.parameters.ParameterString import ParameterString

class lasboundary(LasToolsAlgorithm):
class lasboundary(LAStoolsAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"
CONCAVITY = "CONCAVITY"
DISJOINT = "DISJOINT"
HOLES = "HOLES"

def defineCharacteristics(self):
self.name = "lasboundary"
self.group = "Tools"
self.addParameter(ParameterFile(lasboundary.INPUT, "Input las layer"))
self.addParameter(ParameterNumber(lasboundary.CONCAVITY, "Concavity threshold", 0, None, 50.0))
self.addParameter(ParameterBoolean(lasboundary.HOLES, "Compute also interior holes", False))
self.addParameter(ParameterBoolean(lasboundary.DISJOINT, "Compute disjoint hull", False))
self.addOutput(OutputVector(lasboundary.OUTPUT, "Output boundary layer"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersFilter1ReturnClassFlagsGUI()
self.addParameter(ParameterNumber(lasboundary.CONCAVITY, "concavity", 0, None, 50.0))
self.addParameter(ParameterBoolean(lasboundary.HOLES, "interior holes", False))
self.addParameter(ParameterBoolean(lasboundary.DISJOINT, "disjoint polygon", False))
self.addParametersVectorOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lasboundary.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lasboundary.INPUT))
commands.append("-o")
commands.append(self.getOutputValue(lasboundary.OUTPUT))
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasboundary.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
concavity = self.getParameterValue(lasboundary.CONCAVITY)
commands.append("-concavity")
commands.append(str(self.getParameterValue(lasboundary.CONCAVITY)))
commands.append(str(concavity))
if self.getParameterValue(lasboundary.HOLES):
commands.append("-holes")
if self.getParameterValue(lasboundary.DISJOINT):
commands.append("-disjoint")
self.addCommonParameterValuesToCommand(commands)
self.addParametersVectorOutputCommands(commands)

LasToolsUtils.runLasTools(commands, progress)
LAStoolsUtils.runLAStools(commands, progress)
109 changes: 109 additions & 0 deletions python/plugins/processing/lidar/lastools/lascanopy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lascanopy.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from PyQt4 import QtGui
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterSelection import ParameterSelection

class lascanopy(LAStoolsAlgorithm):

HEIGHT_CUTOFF = "HEIGHT_CUTOFF"
ATTRIBUTE = "ATTRIBUTE"
PRODUCT1 = "PRODUCT1"
PRODUCT2 = "PRODUCT2"
PRODUCT3 = "PRODUCT3"
PRODUCT4 = "PRODUCT4"
PRODUCT5 = "PRODUCT5"
PRODUCT6 = "PRODUCT6"
PRODUCT7 = "PRODUCT7"
PRODUCT8 = "PRODUCT8"
PRODUCT9 = "PRODUCT9"
PRODUCTS = ["---", "min", "max", "avg", "std", "ske", "kur", "cov", "dns", "p01", "p05", "p10", "p25", "p50", "p75", "p90", "p99"]
COUNTS = "COUNTS"
DENSITIES = "DENSITIES"
USE_TILE_BB = "USE_TILE_BB"

def defineCharacteristics(self):
self.name = "lascanopy"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersStepGUI()
self.addParameter(ParameterNumber(lascanopy.HEIGHT_CUTOFF, "height cutoff / breast height", False, False, 1.37))
self.addParameter(ParameterSelection(lascanopy.PRODUCT1, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterSelection(lascanopy.PRODUCT2, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterSelection(lascanopy.PRODUCT3, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterSelection(lascanopy.PRODUCT4, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterSelection(lascanopy.PRODUCT5, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterSelection(lascanopy.PRODUCT6, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterSelection(lascanopy.PRODUCT7, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterSelection(lascanopy.PRODUCT8, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterSelection(lascanopy.PRODUCT9, "create", lascanopy.PRODUCTS, 0))
self.addParameter(ParameterString(lascanopy.COUNTS, "count rasters (e.g. 2.0 5.0 10.0 20.0)", ""))
self.addParameter(ParameterString(lascanopy.DENSITIES, "density rasters (e.g. 2.0 5.0 10.0 20.0)", ""))
self.addParameter(ParameterBoolean(lascanopy.USE_TILE_BB, "use tile bounding box (after tiling with buffer)", False))
self.addParametersRasterOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lascanopy.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersStepCommands(commands)
product = self.getParameterValue(lascanopy.PRODUCT1)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
product = self.getParameterValue(lascanopy.PRODUCT2)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
product = self.getParameterValue(lascanopy.PRODUCT3)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
product = self.getParameterValue(lascanopy.PRODUCT4)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
product = self.getParameterValue(lascanopy.PRODUCT5)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
product = self.getParameterValue(lascanopy.PRODUCT6)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
product = self.getParameterValue(lascanopy.PRODUCT7)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
product = self.getParameterValue(lascanopy.PRODUCT8)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
product = self.getParameterValue(lascanopy.PRODUCT9)
if product != 0:
commands.append("-" + lascanopy.PRODUCTS[product])
self.addParametersRasterOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
37 changes: 18 additions & 19 deletions python/plugins/processing/lidar/lastools/lasclassify.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -24,29 +28,24 @@
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.outputs.OutputFile import OutputFile

class lasclassify(LasToolsAlgorithm):
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

INPUT = "INPUT"
OUTPUT = "OUTPUT"
class lasclassify(LAStoolsAlgorithm):

def defineCharacteristics(self):
self.name = "lasclassify"
self.group = "Tools"
self.addParameter(ParameterFile(lasclassify.INPUT, "Input las layer"))
self.addOutput(OutputFile(lasclassify.OUTPUT, "Output classified las file"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersHorizontalAndVerticalFeetGUI()
self.addParametersPointOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lasclassify.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lasclassify.INPUT))
commands.append("-o")
commands.append(self.getOutputValue(lasclassify.OUTPUT))
self.addCommonParameterValuesToCommand(commands)
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasclassify.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersHorizontalAndVerticalFeetCommands(commands)
self.addParametersPointOutputCommands(commands)

LasToolsUtils.runLasTools(commands, progress)
LAStoolsUtils.runLAStools(commands, progress)
62 changes: 40 additions & 22 deletions python/plugins/processing/lidar/lastools/lasclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -24,34 +28,48 @@
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.outputs.OutputFile import OutputFile
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterSelection import ParameterSelection

class lasclip(LasToolsAlgorithm):
class lasclip(LAStoolsAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"
POLYGON = "POLYGON"
INTERIOR = "INTERIOR"
OPERATION = "OPERATION"
OPERATIONS = ["clip", "classify"]
CLASSIFY_AS = "CLASSIFY_AS"

def defineCharacteristics(self):
self.name = "lasclip"
self.group = "Tools"
self.addParameter(ParameterFile(lasclip.INPUT, "Input las layer"))
self.addParameter(ParameterVector(lasclip.POLYGON, "Input polygons", [ParameterVector.VECTOR_TYPE_POLYGON]))
self.addOutput(OutputFile(lasclip.OUTPUT, "Output classified las file"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI();
self.addParametersPointInputGUI()
self.addParameter(ParameterVector(lasclip.POLYGON, "Input polygon(s)", ParameterVector.VECTOR_TYPE_POLYGON))
self.addParameter(ParameterBoolean(lasclip.INTERIOR, "interior", False))
self.addParameter(ParameterSelection(lasclip.OPERATION, "what to do with isolated points", lasclip.OPERATIONS, 0))
self.addParameter(ParameterNumber(lasclip.CLASSIFY_AS, "classify as", 0, None, 12))
self.addParametersPointOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lasclip.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lasclip.INPUT))
commands.append("-poly")
commands.append(self.getParameterValue(lasclip.POLYGON))
commands.append("-o")
commands.append(self.getOutputValue(lasclip.OUTPUT))
self.addCommonParameterValuesToCommand(commands)

LasToolsUtils.runLasTools(commands, progress)
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasclip.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
poly = self.getParameterValue(lasclip.POLYGON)
if poly != None:
commands.append("-poly")
commands.append(poly)
if self.getParameterValue(lasclip.INTERIOR):
commands.append("-interior")
operation = self.getParameterValue(lasclip.OPERATION)
if operation != 0:
commands.append("-classify")
classify_as = self.getParameterValue(lasclip.CLASSIFY_AS)
commands.append(str(classify_as))
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
71 changes: 71 additions & 0 deletions python/plugins/processing/lidar/lastools/lascontrol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lascontrol.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterSelection import ParameterSelection

class lascontrol(LAStoolsAlgorithm):

POLYGON = "POLYGON"
INTERIOR = "INTERIOR"
OPERATION = "OPERATION"
OPERATIONS = ["clip", "classify"]
CLASSIFY_AS = "CLASSIFY_AS"

def defineCharacteristics(self):
self.name = "lascontrol"
self.group = "LAStools"
self.addParametersVerboseGUI();
self.addParametersPointInputGUI()
self.addParameter(ParameterVector(lascontrol.POLYGON, "Input polygon(s)", ParameterVector.VECTOR_TYPE_POLYGON))
self.addParameter(ParameterBoolean(lascontrol.INTERIOR, "interior", False))
self.addParameter(ParameterSelection(lascontrol.OPERATION, "what to do with isolated points", lascontrol.OPERATIONS, 0))
self.addParameter(ParameterNumber(lascontrol.CLASSIFY_AS, "classify as", 0, None, 12))
self.addParametersPointOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lascontrol.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
poly = self.getParameterValue(lascontrol.POLYGON)
if poly != None:
commands.append("-poly")
commands.append(poly)
if self.getParameterValue(lascontrol.INTERIOR):
commands.append("-interior")
operation = self.getParameterValue(lascontrol.OPERATION)
if operation != 0:
commands.append("-classify")
classify_as = self.getParameterValue(lascontrol.CLASSIFY_AS)
commands.append(str(classify_as))
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
68 changes: 68 additions & 0 deletions python/plugins/processing/lidar/lastools/lasduplicate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lasduplicate.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterFile import ParameterFile

class lasduplicate(LAStoolsAlgorithm):

LOWEST_Z = "LOWEST_Z"
UNIQUE_XYZ = "UNIQUE_XYZ"
SINGLE_RETURNS = "SINGLE_RETURNS"
RECORD_REMOVED = "RECORD_REMOVED"

def defineCharacteristics(self):
self.name = "lasduplicate"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterBoolean(lasduplicate.LOWEST_Z, "keep duplicate with lowest z coordinate", False))
self.addParameter(ParameterBoolean(lasduplicate.UNIQUE_XYZ, "only remove duplicates in x y and z", False))
self.addParameter(ParameterBoolean(lasduplicate.SINGLE_RETURNS, "mark surviving duplicate as single return", False))
self.addParameter(ParameterFile(lasduplicate.RECORD_REMOVED, "record removed duplictates to LAS/LAZ file"))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasduplicate.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
if self.getParameterValue(lasduplicate.LOWEST_Z):
commands.append("-lowest_z")
if self.getParameterValue(lasduplicate.UNIQUE_XYZ):
commands.append("-unique_xyz")
if self.getParameterValue(lasduplicate.SINGLE_RETURNS):
commands.append("-single_returns")
record_removed = self.getParameterValue(lasduplicate.RECORD_REMOVED)
if record_removed != Null:
commands.append("-record_removed")
commands.append(record_removed)
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
57 changes: 32 additions & 25 deletions python/plugins/processing/lidar/lastools/lasgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -25,40 +29,43 @@

import os
from PyQt4 import QtGui
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterString import ParameterString
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.outputs.OutputRaster import OutputRaster
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterSelection import ParameterSelection
from processing.parameters.ParameterFile import ParameterFile

class lasgrid(LasToolsAlgorithm):
class lasgrid(LAStoolsAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"
INTENSITY = "INTENSITY"
ATTRIBUTE = "ATTRIBUTE"
METHOD = "METHOD"
METHODS = ["-average", "-lowest", "-highest", "-stddev"]
ATTRIBUTES = ["elevation", "intensity", "rgb", "classification"]
METHODS = ["lowest", "highest", "average", "stddev"]

def defineCharacteristics(self):
self.name = "lasgrid"
self.group = "Tools"
self.addParameter(ParameterFile(lasgrid.INPUT, "Input las layer"))
self.addParameter(ParameterBoolean(lasgrid.INTENSITY, "Use intensity instead of elevation", False))
self.addParameter(ParameterSelection(lasgrid.METHOD, "Method", lasgrid.METHODS))
self.addOutput(OutputRaster(lasgrid.OUTPUT, "Output grid layer"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersFilter1ReturnClassFlagsGUI()
self.addParametersStepGUI()
self.addParameter(ParameterSelection(lasgrid.ATTRIBUTE, "Attribute", lasgrid.ATTRIBUTES, 0))
self.addParameter(ParameterSelection(lasgrid.METHOD, "Method", lasgrid.METHODS, 0))
self.addParametersRasterOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lasgrid.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lasgrid.INPUT))
commands.append("-o")
commands.append(self.getOutputValue(lasgrid.OUTPUT))
if self.getParameterValue(lasgrid.INTENSITY):
commands.append("-intensity")
commands.append(lasgrid.METHODS[self.getParameterValue(lasgrid.METHOD)])
self.addCommonParameterValuesToCommand(commands)
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasgrid.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
self.addParametersStepCommands(commands)
attribute = self.getParameterValue(lasgrid.ATTRIBUTE)
if attribute != 0:
commands.append("-" + lasgrid.ATTRIBUTES[attribute])
method = self.getParameterValue(lasgrid.METHOD)
if method != 0:
commands.append("-" + lasgrid.METHODS[method])
self.addParametersRasterOutputCommands(commands)

LasToolsUtils.runLasTools(commands, progress)
LAStoolsUtils.runLAStools(commands, progress)
61 changes: 35 additions & 26 deletions python/plugins/processing/lidar/lastools/lasground.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -25,37 +29,42 @@

import os
from PyQt4 import QtGui
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterSelection import ParameterSelection
from processing.parameters.ParameterFile import ParameterFile
from processing.outputs.OutputFile import OutputFile

class lasground(LasToolsAlgorithm):
class lasground(LAStoolsAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"
INTENSITY = "INTENSITY"
METHOD = "METHOD"
METHODS = ["terrain", "town", "city"]
AIRBORNE = "AIRBORNE"
TERRAIN = "TERRAIN"
TERRAINS = ["wilderness", "nature", "town", "city", "metro"]
GRANULARITY = "GRANULARITY"
GRANULARITIES = ["coarse", "default", "fine", "extra_fine", "ultra_fine"]

def defineCharacteristics(self):
self.name = "lasground"
self.group = "Tools"
self.addParameter(ParameterFile(lasground.INPUT, "Input las layer"))
self.addParameter(ParameterSelection(lasground.METHOD, "Method", lasground.METHODS))
self.addOutput(OutputFile(lasground.OUTPUT, "Output ground las file"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersHorizontalAndVerticalFeetGUI()
self.addParameter(ParameterBoolean(lasground.AIRBORNE, "airborne LiDAR", True))
self.addParameter(ParameterSelection(lasground.TERRAIN, "terrain type", lasground.TERRAINS, 1))
self.addParameter(ParameterSelection(lasground.GRANULARITY, "preprocessing", lasground.GRANULARITIES, 1))
self.addParametersPointOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lasground.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lasground.INPUT))
commands.append("-o")
commands.append(self.getOutputValue(lasground.OUTPUT))
method = self.getParameterValue(lasground.METHOD)
if method != 0:
commands.append("-" + lasground.METHODS[method])
self.addCommonParameterValuesToCommand(commands)

LasToolsUtils.runLasTools(commands, progress)
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasground.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersHorizontalAndVerticalFeetCommands(commands)
method = self.getParameterValue(lasground.TERRAIN)
if method != 1:
commands.append("-" + lasground.TERRAINS[method])
granularity = self.getParameterValue(lasground.GRANULARITY)
if granularity != 1:
commands.append("-" + lasground.GRANULARITIES[granularity])
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
48 changes: 25 additions & 23 deletions python/plugins/processing/lidar/lastools/lasheight.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

"""
***************************************************************************
lasheight.py
lasduplicate.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -24,29 +24,31 @@
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.outputs.OutputFile import OutputFile
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

class lasheight(LasToolsAlgorithm):
from processing.parameters.ParameterBoolean import ParameterBoolean

INPUT = "INPUT"
OUTPUT = "OUTPUT"
class lasheight(LAStoolsAlgorithm):

REPLACE_Z = "REPLACE_Z"

def defineCharacteristics(self):
self.name = "lasheight"
self.group = "Tools"
self.addParameter(ParameterFile(lasheight.INPUT, "Input las layer"))
self.addOutput(OutputFile(lasheight.OUTPUT, "Output height las file"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterBoolean(lasheight.REPLACE_Z, "replace z", False))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lasheight.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lasheight.INPUT))
commands.append("-o")
commands.append(self.getOutputValue(lasheight.OUTPUT))
self.addCommonParameterValuesToCommand(commands)

LasToolsUtils.runLasTools(commands, progress)
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasheight.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
replace_z = self.getParameterValue(lasheight.REPLACE_Z)
if replace_z == True:
commands.append("-replace_z")
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
54 changes: 54 additions & 0 deletions python/plugins/processing/lidar/lastools/lasindex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lasindex.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean

class lasindex(LAStoolsAlgorithm):

MOBILE_OR_TERRESTRIAL = "MOBILE_OR_TERRESTRIAL"

def defineCharacteristics(self):
self.name = "lasindex"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterBoolean(lasindex.MOBILE_OR_TERRESTRIAL, "is mobile or terrestrial LiDAR (not airborne)", False))


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasindex.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
if self.getParameterValue(lasindex.MOBILE_OR_TERRESTRIAL):
commands.append("-tile_size")
commands.append("10")
commands.append("-maximum")
commands.append("-100")

LAStoolsUtils.runLAStools(commands, progress)
38 changes: 17 additions & 21 deletions python/plugins/processing/lidar/lastools/lasinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -24,35 +28,27 @@
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.outputs.OutputHTML import OutputHTML
from processing.outputs.OutputFile import OutputFile

class lasinfo(LasToolsAlgorithm):
class lasinfo(LAStoolsAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"

def defineCharacteristics(self):
self.name = "lasinfo"
self.group = "Tools"
self.addParameter(ParameterFile(lasinfo.INPUT, "Input las layer"))
self.addOutput(OutputHTML(lasinfo.OUTPUT, "Output info file"))
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addOutput(OutputFile(lasinfo.OUTPUT, "Output ASCII file"))

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lasinfo.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lasinfo.INPUT))
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasinfo.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
commands.append("-o")
commands.append(self.getOutputValue(lasinfo.OUTPUT) + ".txt")

LasToolsUtils.runLasTools(commands, progress)
fin = open (self.getOutputValue(lasinfo.OUTPUT) + ".txt")
fout = open (self.getOutputValue(lasinfo.OUTPUT), "w")
lines = fin.readlines()
for line in lines:
fout.write(line + "<br>")
fin.close()
fout.close()
commands.append(self.getOutputValue(lasinfo.OUTPUT))

LAStoolsUtils.runLAStools(commands, progress)
87 changes: 87 additions & 0 deletions python/plugins/processing/lidar/lastools/lasmerge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lasmerge.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterFile import ParameterFile

class lasmerge(LAStoolsAlgorithm):

FILE2 = "FILE2"
FILE3 = "FILE3"
FILE4 = "FILE4"
FILE5 = "FILE5"
FILE6 = "FILE6"
FILE7 = "FILE7"

def defineCharacteristics(self):
self.name = "lasmerge"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersFilesAreFlightlinesGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterFile(lasmerge.FILE2, "2nd file"))
self.addParameter(ParameterFile(lasmerge.FILE3, "3rd file"))
self.addParameter(ParameterFile(lasmerge.FILE4, "4th file"))
self.addParameter(ParameterFile(lasmerge.FILE5, "5th file"))
self.addParameter(ParameterFile(lasmerge.FILE6, "6th file"))
self.addParameter(ParameterFile(lasmerge.FILE7, "7th file"))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasmerge.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersFilesAreFlightlinesCommands(commands)
self.addParametersPointInputCommands(commands)
file2 = self.getParameterValue(lasmerge.FILE2)
if file2 != None:
commands.append("-i")
commands.append(file2)
file3 = self.getParameterValue(lasmerge.FILE3)
if file3 != None:
commands.append("-i")
commands.append(file3)
file4 = self.getParameterValue(lasmerge.FILE4)
if file4 != None:
commands.append("-i")
commands.append(file4)
file5 = self.getParameterValue(lasmerge.FILE5)
if file5 != None:
commands.append("-i")
commands.append(file5)
file6 = self.getParameterValue(lasmerge.FILE6)
if file6 != None:
commands.append("-i")
commands.append(file6)
file7 = self.getParameterValue(lasmerge.FILE7)
if file7 != None:
commands.append("-i")
commands.append(file7)
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
77 changes: 77 additions & 0 deletions python/plugins/processing/lidar/lastools/lasnoise.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lasnoise.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterSelection import ParameterSelection

class lasnoise(LAStoolsAlgorithm):

ISOLATED = "ISOLATED"
STEP_XY = "STEP_XY"
STEP_Z = "STEP_Z"
OPERATION = "OPERATION"
OPERATIONS = ["classify", "remove"]
CLASSIFY_AS = "CLASSIFY_AS"

def defineCharacteristics(self):
self.name = "lasnoise"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterNumber(lasnoise.ISOLATED, "isolated if surrounding cells have only", 0, None, 5))
self.addParameter(ParameterNumber(lasnoise.STEP_XY, "resolution of isolation grid in xy", 0, None, 4.0))
self.addParameter(ParameterNumber(lasnoise.STEP_Z, "resolution of isolation grid in z ", 0, None, 4.0))
self.addParameter(ParameterSelection(lasnoise.OPERATION, "what to do with isolated points", lasnoise.OPERATIONS, 0))
self.addParameter(ParameterNumber(lasnoise.CLASSIFY_AS, "classify as", 0, None, 7))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasnoise.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
isolated = self.getParameterValue(lasnoise.ISOLATED)
commands.append("-isolated")
commands.append(str(isolated))
step_xy = self.getParameterValue(lasnoise.STEP_XY)
commands.append("-step_xy")
commands.append(str(step_xy))
step_z = self.getParameterValue(lasnoise.STEP_Z)
commands.append("-step_z")
commands.append(str(step_z))
operation = self.getParameterValue(lasnoise.OPERATION)
if operation != 0:
commands.append("-remove_noise")
else:
commands.append("-classify_as")
classify_as = self.getParameterValue(lasnoise.CLASSIFY_AS)
commands.append(str(classify_as))
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
69 changes: 69 additions & 0 deletions python/plugins/processing/lidar/lastools/lasoverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lasoverage.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterSelection import ParameterSelection

class lasoverage(LAStoolsAlgorithm):

CHECK_STEP = "CHECK_STEP"
OPERATION = "OPERATION"
OPERATIONS= ["classify as overlap", "flag as withheld", "remove from output"]

def defineCharacteristics(self):
self.name = "lasoverage"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersHorizontalFeetGUI()
self.addParametersFilesAreFlightlinesGUI()
self.addParameter(ParameterNumber(lasoverage.CHECK_STEP, "size of grid used for scan angle check", 0, None, 1.0))
self.addParameter(ParameterSelection(lasoverage.OPERATION, "mode of operation", lasoverage.OPERATIONS, 0))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasoverage.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersHorizontalFeetCommands(commands)
self.addParametersFilesAreFlightlinesCommands(commands)
step = self.getParameterValue(lasoverage.CHECK_STEP)
if step != 1.0:
commands.append("-step")
commands.append(str(step))
operation = self.getParameterValue(lasoverage.OPERATION)
if operation != 0:
commands.append("-" + OPERATIONS[operation])
if self.getParameterValue(lasoverage.WITHHELD):
commands.append("-withheld")
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
81 changes: 81 additions & 0 deletions python/plugins/processing/lidar/lastools/lasoverlap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lasoverlap.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from PyQt4 import QtGui
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterSelection import ParameterSelection

class lasoverlap(LAStoolsAlgorithm):

CHECK_STEP = "CHECK_STEP"
ATTRIBUTE = "ATTRIBUTE"
OPERATION = "OPERATION"
ATTRIBUTES = ["elevation", "intensity", "number_of_returns", "scan_angle_abs", "density"]
OPERATIONS = ["lowest", "highest", "average"]
CREATE_OVERLAP_RASTER = "CREATE_OVERLAP_RASTER"
CREATE_DIFFERENCE_RASTER = "CREATE_DIFFERENCE_RASTER"

def defineCharacteristics(self):
self.name = "lasoverlap"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersFilter1ReturnClassFlagsGUI()
self.addParameter(ParameterNumber(lasoverlap.CHECK_STEP, "size of grid used for overlap check", 0, None, 2.0))
self.addParameter(ParameterSelection(lasoverlap.ATTRIBUTE, "attribute to check", lasoverlap.ATTRIBUTES, 0))
self.addParameter(ParameterSelection(lasoverlap.OPERATION, "operation on attribute per cell", lasoverlap.OPERATIONS, 0))
self.addParameter(ParameterBoolean(lasoverlap.CREATE_OVERLAP_RASTER, "create overlap raster", True))
self.addParameter(ParameterBoolean(lasoverlap.CREATE_DIFFERENCE_RASTER, "create difference raster", True))
self.addParametersRasterOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasoverlap.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
step = self.getParameterValue(lasoverlap.CHECK_STEP)
if step != 0.0:
commands.append("-step")
commands.append(str(step))
commands.append("-values")
attribute = self.getParameterValue(lasoverlap.ATTRIBUTE)
if attribute != 0:
commands.append("-" + lasoverlap.ATTRIBUTES[attribute])
operation = self.getParameterValue(lasoverlap.OPERATION)
if operation != 0:
commands.append("-" + lasoverlap.OPERATIONS[operation])
if self.getParameterValue(lasoverlap.CREATE_OVERLAP_RASTER) != True:
commands.append("-no_over")
if self.getParameterValue(lasoverlap.CREATE_DIFFERENCE_RASTER) != True:
commands.append("-no_diff")
self.addParametersRasterOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
42 changes: 19 additions & 23 deletions python/plugins/processing/lidar/lastools/lasprecision.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -25,35 +29,27 @@

import os
from PyQt4 import QtGui
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.outputs.OutputHTML import OutputHTML
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.outputs.OutputFile import OutputFile

class lasprecision(LasToolsAlgorithm):
class lasprecision(LAStoolsAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"

def defineCharacteristics(self):
self.name = "lasprecision"
self.group = "Tools"
self.addParameter(ParameterFile(lasprecision.INPUT, "Input las layer"))
self.addOutput(OutputHTML(lasprecision.OUTPUT, "Output info file"))
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addOutput(OutputFile(lasprecision.OUTPUT, "Output ASCII file"))

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lasprecision.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lasprecision.INPUT))
commands.append(">")
commands.append(self.getOutputValue(lasprecision.OUTPUT) + ".txt")

LasToolsUtils.runLasTools(commands, progress)
fin = open (self.getOutputValue(lasprecision.OUTPUT) + ".txt")
fout = open (self.getOutputValue(lasprecision.OUTPUT), "w")
lines = fin.readlines()
for line in lines:
fout.write(line + "<br>")
fin.close()
fout.close()
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasprecision.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
commands.append("-o")
commands.append(self.getOutputValue(lasprecision.OUTPUT))

LAStoolsUtils.runLAStools(commands, progress)
57 changes: 57 additions & 0 deletions python/plugins/processing/lidar/lastools/lassort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lassort.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean

class lassort(LAStoolsAlgorithm):

BY_GPS_TIME = "BY_GPS_TIME"
BY_POINT_SOURCE_ID = "BY_POINT_SOURCE_ID"

def defineCharacteristics(self):
self.name = "lassort"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterBoolean(lassort.BY_GPS_TIME, "sort by GPS time", False))
self.addParameter(ParameterBoolean(lassort.BY_POINT_SOURCE_ID, "sort by point source ID", False))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lassort.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
if self.getParameterValue(lassort.BY_GPS_TIME):
commands.append("-gps_time")
if self.getParameterValue(lassort.BY_POINT_SOURCE_ID):
commands.append("-point_source")
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
37 changes: 18 additions & 19 deletions python/plugins/processing/lidar/lastools/lassplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -24,34 +28,29 @@
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LasToolsUtils import LasToolsUtils
from processing.lidar.lastools.LasToolsAlgorithm import LasToolsAlgorithm
from processing.parameters.ParameterFile import ParameterFile
from processing.outputs.OutputFile import OutputFile
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterNumber import ParameterNumber

class lassplit(LasToolsAlgorithm):
class lassplit(LAStoolsAlgorithm):

INPUT = "INPUT"
OUTPUT = "OUTPUT"
NUM_POINTS = "NUM_POINTS"

def defineCharacteristics(self):
self.name = "lassplit"
self.group = "Tools"
self.addParameter(ParameterFile(lassplit.INPUT, "Input las layer"))
self.addParameter(ParameterNumber(lassplit.NUM_POINTS, "Point in each output file", 1, None, 1000000))
self.addOutput(OutputFile(lassplit.OUTPUT, "Output las file basename"))
self.addCommonParameters()
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterNumber(lassplit.NUM_POINTS, "number of points in output files", 1, None, 1000000))
self.addParametersPointOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lassplit.exe")]
commands.append("-i")
commands.append(self.getParameterValue(lassplit.INPUT))
commands.append("-o")
commands.append(self.getOutputValue(lassplit.OUTPUT))
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lassplit.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
commands.append("-split")
commands.append(self.getParameterValue(lassplit.NUM_POINTS))
self.addCommonParameterValuesToCommand(commands)
self.addParametersPointOutputCommands(commands)

LasToolsUtils.runLasTools(commands, progress)
LAStoolsUtils.runLAStools(commands, progress)
67 changes: 67 additions & 0 deletions python/plugins/processing/lidar/lastools/lasthin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lasthin.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterSelection import ParameterSelection

class lasthin(LAStoolsAlgorithm):

THIN_STEP = "THIN_STEP"
OPERATION = "OPERATION"
OPERATIONS= ["lowest", "random", "highest"]
WITHHELD = "WITHHELD"

def defineCharacteristics(self):
self.name = "lasthin"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParameter(ParameterNumber(lasthin.THIN_STEP, "size of grid used for thinning", 0, None, 1.0))
self.addParameter(ParameterSelection(lasthin.OPERATION, "keep particular point per cell", lasthin.OPERATIONS, 0))
self.addParameter(ParameterBoolean(lasthin.WITHHELD, "mark points as withheld", False))
self.addParametersPointOutputGUI()


def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasthin.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
step = self.getParameterValue(lasthin.THIN_STEP)
if step != 0.0:
commands.append("-step")
commands.append(str(step))
operation = self.getParameterValue(lasthin.OPERATION)
if operation != 0:
commands.append("-" + OPERATIONS[operation])
if self.getParameterValue(lasthin.WITHHELD):
commands.append("-withheld")
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
66 changes: 66 additions & 0 deletions python/plugins/processing/lidar/lastools/lastile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lastile.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm

from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber

class lastile(LAStoolsAlgorithm):

TILE_SIZE = "TILE_SIZE"
BUFFER = "BUFFER"
REVERSIBLE = "REVERSIBLE"

def defineCharacteristics(self):
self.name = "lastile"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addParametersFilesAreFlightlinesGUI()
self.addParameter(ParameterNumber(lastile.TILE_SIZE, "tile size (side length of square tile)", None, None, 1000.0))
self.addParameter(ParameterNumber(lastile.BUFFER, "buffer around each tile", None, None, 0.0))
self.addParameter(ParameterNumber(lastile.BUFFER, "make tiling reversible (advanced)", False))
self.addParametersPointOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lastile.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilesAreFlightlinesCommands(commands)
tile_size = self.getParameterValue(lastile.TILE_SIZE)
commands.append("-tile_size")
commands.append(str(tile_size))
buffer = self.getParameterValue(lastile.BUFFER)
if buffer != 0.0:
commands.append("-buffer")
commands.append(str(buffer))
if self.getParameterValue(lastile.REVERSIBLE):
commands.append("-reversible")
self.addParametersPointOutputCommands(commands)

LAStoolsUtils.runLAStools(commands, progress)
49 changes: 49 additions & 0 deletions python/plugins/processing/lidar/lastools/lasvalidate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
lasvalidate.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point 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__ = 'Martin Isenburg'
__date__ = 'September 2013'
__copyright__ = '(C) 2013, Martin Isenburg'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtils
from processing.lidar.lastools.LAStoolsAlgorithm import LAStoolsAlgorithm
from processing.outputs.OutputFile import OutputFile

class lasvalidate(LAStoolsAlgorithm):

OUTPUT = "OUTPUT"

def defineCharacteristics(self):
self.name = "lasvalidate"
self.group = "LAStools"
self.addParametersVerboseGUI()
self.addParametersPointInputGUI()
self.addOutput(OutputFile(lasvalidate.OUTPUT, "Output XML file"))

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasvalidate.exe")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
commands.append("-o")
commands.append(self.getOutputValue(lasvalidate.OUTPUT))

LAStoolsUtils.runLAStools(commands, progress)
Loading