Exemple #1
0
    def defineCharacteristics(self):
        self.name = "Geometry Export"
        self.group = "Transfer"

        self.addParameter(
            ParameterVector(self.LAYERNAME, "Source Layer",
                            ParameterVector.VECTOR_TYPE_ANY))

        self.addOutput(
            OutputTable(self.NODEFILENAME, "Node CSV Output File Name"))
        self.addOutput(
            OutputTable(self.ATTRIBUTEFILENAME,
                        "Attribute CSV Output File Name (non-points only)"))

        self.delimiters = ["Comma", "Bar", "Space"]
        self.addParameter(
            ParameterSelection(self.FIELDDELIMITER,
                               "Delimiter",
                               self.delimiters,
                               default=0))

        self.terminators = ["CRLF", "LF"]
        self.addParameter(
            ParameterSelection(self.LINETERMINATOR,
                               "Delimiter",
                               self.terminators,
                               default=0))
Exemple #2
0
 def defineCharacteristics(self):
     self.name = "Raster layer histogram"
     self.group = "Graphics"
     self.addParameter(ParameterRaster(self.INPUT, "Input layer"))
     self.addParameter(
         ParameterNumber(self.BINS, "Number of bins", 2, None, 10))
     self.addOutput(OutputHTML(self.PLOT, "Output plot"))
     self.addOutput(OutputTable(self.TABLE, "Output table"))
Exemple #3
0
 def defineCharacteristics(self):
     self.name = "Canopy Maxima"
     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.THRESHOLD, "Minimum threshold", 0, None, 10.0))
     self.addOutput(OutputTable(self.OUTPUT, "Output file with maxima"))
     self.addAdvancedModifiers()
Exemple #4
0
 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()
 def defineCharacteristics(self):
     self.name = "Grid Metrics"
     self.group = "Points"
     self.addParameter(ParameterFile(self.INPUT, "Input las layer"))
     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()
Exemple #6
0
    def defineCharacteristics(self):
        self.name = "Statistics by categories"
        self.group = "Vector table tools"

        self.addParameter(ParameterVector(self.INPUT_LAYER, "Input vector layer", ParameterVector.VECTOR_TYPE_ANY, False))
        self.addParameter(ParameterTableField(self.VALUES_FIELD_NAME, "Field to calculate statistics on",
                                              self.INPUT_LAYER, ParameterTableField.DATA_TYPE_NUMBER))
        self.addParameter(ParameterTableField(self.CATEGORIES_FIELD_NAME, "Field with categories",
                                              self.INPUT_LAYER, ParameterTableField.DATA_TYPE_ANY))

        self.addOutput(OutputTable(self.OUTPUT, "Statistics"))
Exemple #7
0
    def defineCharacteristics(self):
        self.name = "Geocode using Google"
        self.group = "Vector general tools"

        self.addParameter(ParameterTable(self.CSVNAME, "Input table", False))
        self.addParameter(
            ParameterTableField(self.ADDRESS, "Address", self.CSVNAME))
        self.addParameter(ParameterTableField(self.CITY, "City", self.CSVNAME))
        self.addParameter(
            ParameterTableField(self.STATE, "State", self.CSVNAME))
        self.addParameter(
            ParameterTableField(self.COUNTRY, "Country", self.CSVNAME))

        self.addOutput(OutputVector(self.SHAPEFILENAME, "Output"))
        self.addOutput(OutputTable(self.NOTFOUNDFILE, "Not found output list"))
Exemple #8
0
    def defineCharacteristics(self):
        self.name = "Geocode Google"
        self.group = "Transfer"

        self.addParameter(ParameterTable(self.CSVNAME, "Input CSV File",
                                         False))
        self.addParameter(
            ParameterTableField(self.ADDRESS, "Address", self.CSVNAME))
        self.addParameter(ParameterTableField(self.CITY, "City", self.CSVNAME))
        self.addParameter(
            ParameterTableField(self.STATE, "State", self.CSVNAME))
        self.addParameter(
            ParameterTableField(self.COUNTRY, "Country", self.CSVNAME))

        self.addOutput(OutputVector(self.SHAPEFILENAME, "Output Shapefile"))
        self.addOutput(
            OutputTable(self.NOTFOUNDFILE, "Not Found CSV Output List"))
Exemple #9
0
    def defineCharacteristics(self):
        self.name = "Attribute Join"
        self.group = "Transfer"

        self.addParameter(
            ParameterTable(self.INFILENAME, "Input CSV File", False))
        self.addParameter(
            ParameterTableField(self.JOINFIELD, "CSV File Field",
                                self.INFILENAME))

        self.addParameter(
            ParameterVector(self.LAYERNAME, "Join Layer",
                            ParameterVector.VECTOR_TYPE_ANY))
        self.addParameter(
            ParameterTableField(self.JOINATTRIBUTE, "Join Layer Attribute",
                                mmqgisx_attribute_join_dialog.LAYERNAME))

        self.addOutput(OutputVector(self.OUTFILENAME, "Output Shapefile"))
        self.addOutput(
            OutputTable(self.NOTFOUNDNAME, "Not Found CSV Output List"))
Exemple #10
0
    def defineCharacteristics(self):
        self.name = "Attribute join"
        self.group = "Vector table tools"

        self.addParameter(
            ParameterVector(self.LAYERNAME, "Input layer",
                            ParameterVector.VECTOR_TYPE_ANY))
        self.addParameter(
            ParameterTableField(self.JOINATTRIBUTE, "Layer attribute field",
                                mmqgisx_attribute_join_algorithm.LAYERNAME))

        self.addParameter(
            ParameterTable(self.INFILENAME, "Table to join", False))
        self.addParameter(
            ParameterTableField(self.JOINFIELD, "Table field",
                                self.INFILENAME))

        self.addOutput(OutputVector(self.OUTFILENAME, "Output"))
        self.addOutput(
            OutputTable(self.NOTFOUNDNAME, "Not Found CSV Output List"))
Exemple #11
0
    def defineCharacteristics(self):
        self.name = "Attribute Export"
        self.group = "Transfer"

        self.addParameter(
            ParameterVector(self.LAYERNAME, "SourceLayer",
                            ParameterVector.VECTOR_TYPE_ANY))

        self.delimiters = ["Comma", "Bar", "Space"]
        self.addParameter(
            ParameterSelection(self.FIELDDELIMITER,
                               "Delimiter",
                               self.delimiters,
                               default=0))

        self.terminators = ["CRLF", "LF"]
        self.addParameter(
            ParameterSelection(self.LINETERMINATOR,
                               "Delimiter",
                               self.terminators,
                               default=0))

        self.addOutput(OutputTable(self.OUTFILENAME, "Output CSV File"))
Exemple #12
0
    def processParameterLine(self,line):
        param = None
        out = None
        line = line.replace("#", "");
        # If the line is in the format of the text description files for normal algorithms,
        # then process it using parameter and output factories
        if '|' in line:
            self.processDescriptionParameterLine(line)
            return
        tokens = line.split("=");
        desc = self.createDescriptiveName(tokens[0])
        if tokens[1].lower().strip() == "group":
            self.group = tokens[0]
            return
        if tokens[1].lower().strip() == "name":
            self.name = tokens[0]
            return
        if tokens[1].lower().strip() == "raster":
            param = ParameterRaster(tokens[0], desc, False)
        elif tokens[1].lower().strip() == "vector":
            param = ParameterVector(tokens[0],  desc,ParameterVector.VECTOR_TYPE_ANY)
        elif tokens[1].lower().strip() == "table":
            param = ParameterTable(tokens[0], desc, False)
        elif tokens[1].lower().strip() == "multiple raster":
            param = ParameterMultipleInput(tokens[0], desc, ParameterMultipleInput.TYPE_RASTER)
            param.optional = False
        elif tokens[1].lower().strip() == "multiple vector":
            param = ParameterMultipleInput(tokens[0], desc, ParameterMultipleInput.TYPE_VECTOR_ANY)
            param.optional = False
        elif tokens[1].lower().strip().startswith("selection"):
            options = tokens[1].strip()[len("selection"):].split(";")
            param = ParameterSelection(tokens[0],  desc, options);
        elif tokens[1].lower().strip().startswith("boolean"):
            default = tokens[1].strip()[len("boolean")+1:]
            param = ParameterBoolean(tokens[0],  desc, default)
        elif tokens[1].lower().strip() == "extent":
            param = ParameterExtent(tokens[0],  desc)
        elif tokens[1].lower().strip() == "file":
            param = ParameterFile(tokens[0],  desc, False)
        elif tokens[1].lower().strip() == "folder":
            param = ParameterFile(tokens[0],  desc, True)
        elif tokens[    1].lower().strip().startswith("number"):
            default = tokens[1].strip()[len("number")+1:]
            param = ParameterNumber(tokens[0],  desc, default=default)
        elif tokens[1].lower().strip().startswith("field"):
            field = tokens[1].strip()[len("field")+1:]
            found = False
            for p in self.parameters:
                if p.name == field:
                    found = True
                    break
            if found:
                param = ParameterTableField(tokens[0],  tokens[0], field)
        elif tokens[1].lower().strip().startswith("string"):
            default = tokens[1].strip()[len("string")+1:]
            param = ParameterString(tokens[0],  desc, default)
        elif tokens[1].lower().strip().startswith("output raster"):
            out = OutputRaster()
        elif tokens[1].lower().strip().startswith("output vector"):
            out = OutputVector()
        elif tokens[1].lower().strip().startswith("output table"):
            out = OutputTable()
        elif tokens[1].lower().strip().startswith("output html"):
            out = OutputHTML()
        elif tokens[1].lower().strip().startswith("output file"):
            out = OutputFile()
        elif tokens[1].lower().strip().startswith("output number"):
            out = OutputNumber()
        elif tokens[1].lower().strip().startswith("output string"):
            out = OutputString()

        if param != None:
            self.addParameter(param)
        elif out != None:
            out.name = tokens[0]
            out.description = tokens[0]
            self.addOutput(out)
        else:
            raise WrongScriptException("Could not load script:" + self.descriptionFile + ".\n Problem with line \"" + line + "\"")
Exemple #13
0
    def processParameterLine(self, line):
        param = None
        out = None
        line = line.replace("#", "")
        if line.lower().strip().startswith("showplots"):
            self.showPlots = True
            self.addOutput(OutputHTML(RAlgorithm.RPLOTS, "R Plots"))
            return
        if line.lower().strip().startswith("dontuserasterpackage"):
            self.useRasterPackage = False
            return
        if line.lower().strip().startswith("passfilenames"):
            self.passFileNames = True
            return
        tokens = line.split("=")
        desc = self.createDescriptiveName(tokens[0])
        if tokens[1].lower().strip() == "group":
            self.group = tokens[0]
            return
        if tokens[1].lower().strip().startswith("raster"):
            param = ParameterRaster(tokens[0], desc, False)
        elif tokens[1].lower().strip() == "vector":
            param = ParameterVector(tokens[0], desc,
                                    ParameterVector.VECTOR_TYPE_ANY)
        elif tokens[1].lower().strip() == "table":
            param = ParameterTable(tokens[0], desc, False)
        elif tokens[1].lower().strip().startswith("multiple raster"):
            param = ParameterMultipleInput(tokens[0], desc,
                                           ParameterMultipleInput.TYPE_RASTER)
            param.optional = False
        elif tokens[1].lower().strip() == "multiple vector":
            param = ParameterMultipleInput(
                tokens[0], desc, ParameterMultipleInput.TYPE_VECTOR_ANY)
            param.optional = False
        elif tokens[1].lower().strip().startswith("selection"):
            options = tokens[1].strip()[len("selection"):].split(";")
            param = ParameterSelection(tokens[0], desc, options)
        elif tokens[1].lower().strip().startswith("boolean"):
            default = tokens[1].strip()[len("boolean") + 1:]
            param = ParameterBoolean(tokens[0], desc, default)
        elif tokens[1].lower().strip().startswith("number"):
            try:
                default = float(tokens[1].strip()[len("number") + 1:])
                param = ParameterNumber(tokens[0], desc, default=default)
            except:
                raise WrongScriptException("Could not load R script:" +
                                           self.descriptionFile +
                                           ".\n Problem with line \"" + line +
                                           "\"")
        elif tokens[1].lower().strip().startswith("field"):
            field = tokens[1].strip()[len("field") + 1:]
            found = False
            for p in self.parameters:
                if p.name == field:
                    found = True
                    break
            if found:
                param = ParameterTableField(tokens[0], tokens[0], field)
        elif tokens[1].lower().strip() == "extent":
            param = ParameterExtent(tokens[0], desc)
        elif tokens[1].lower().strip() == "file":
            param = ParameterFile(tokens[0], desc, False)
        elif tokens[1].lower().strip() == "folder":
            param = ParameterFile(tokens[0], desc, True)
        elif tokens[1].lower().strip().startswith("string"):
            default = tokens[1].strip()[len("string") + 1:]
            param = ParameterString(tokens[0], desc, default)
        elif tokens[1].lower().strip().startswith("output raster"):
            out = OutputRaster()
        elif tokens[1].lower().strip().startswith("output vector"):
            out = OutputVector()
        elif tokens[1].lower().strip().startswith("output table"):
            out = OutputTable()
        elif tokens[1].lower().strip().startswith("output file"):
            out = OutputFile()

        if param != None:
            self.addParameter(param)
        elif out != None:
            out.name = tokens[0]
            out.description = tokens[0]
            self.addOutput(out)
        else:
            raise WrongScriptException("Could not load R script:" +
                                       self.descriptionFile +
                                       ".\n Problem with line \"" + line +
                                       "\"")