Ejemplo n.º 1
0
 def defineCharacteristics(self):
     self.name = "Warp (reproject)"
     self.group = "[GDAL] Projections"
     self.addParameter(ParameterRaster(warp.INPUT, "Input layer", False))
     self.addParameter(ParameterCrs(warp.SOURCE_SRS, "Source SRS (EPSG Code)", "EPSG:4326"))
     self.addParameter(ParameterCrs(warp.DEST_SRS, "Destination SRS (EPSG Code)", "EPSG:4326"))
     self.addParameter(ParameterNumber(warp.TR, "Output file resolution in target georeferenced units (leave 0 for no change)", 0.0, None, 0.0))
     self.addParameter(ParameterSelection(warp.METHOD, "Resampling method", warp.METHOD_OPTIONS))
     self.addParameter(ParameterString(warp.EXTRA, "Additional creation parameters", " "))
     self.addOutput(OutputRaster(warp.OUTPUT, "Output layer"))
Ejemplo n.º 2
0
 def defineCharacteristics(self):
     self.name = "Warp (reproject)"
     self.group = "[GDAL] Projections"
     self.addParameter(ParameterRaster(warp.INPUT, "Input layer", False))
     self.addParameter(
         ParameterCrs(warp.SOURCE_SRS, "Source SRS (EPSG Code)", "4326"))
     self.addParameter(
         ParameterCrs(warp.DEST_SRS, "Destination SRS (EPSG Code)", "4326"))
     self.addParameter(
         ParameterSelection(warp.METHOD, "Resampling method",
                            warp.METHOD_OPTIONS))
     self.addOutput(OutputRaster(warp.OUTPUT, "Output layer"))
Ejemplo n.º 3
0
 def testParameterCRS(self):
     param = ParameterCrs("name", "desc")
     assert param.setValue("EPSG:12003")
     assert param.value == "EPSG:12003"
     assert param.setValue(None)
     assert param.value == param.default
     s = param.serialize()
     param2 = ParameterCrs()
     param2.deserialize(s)
     assert param.default == param2.default
     assert param.description == param2.description
     assert param.name == param2.name
Ejemplo n.º 4
0
    def buildParametersDialog(self):
        for input in self.process.inputs:
            inputType = type(input)
            if inputType == VectorInput:
                self.addParameter(ParameterVector(str(input.identifier), str(input.title), ParameterVector.VECTOR_TYPE_ANY, input.minOccurs == 0))
            elif inputType == MultipleVectorInput:
                self.addParameter(ParameterMultipleInput(str(input.identifier), str(input.title), ParameterVector.VECTOR_TYPE_ANY, input.minOccurs == 0))
            elif inputType == StringInput:
                self.addParameter(ParameterString(str(input.identifier), str(input.title)))
            elif inputType == TextInput:
                self.addParameter(ParameterString(str(input.identifier), str(input.title)))
            elif inputType == RasterInput:
                self.addParameter(ParameterRaster(str(input.identifier), str(input.title), input.minOccurs == 0))
            elif inputType == MultipleRasterInput:
                self.addParameter(ParameterMultipleInput(str(input.identifier), str(input.title), ParameterMultipleInput.TYPE_RASTER, input.minOccurs == 0))
            elif inputType == FileInput:
                #self.addParameter(ParameterFile(str(input.identifier), str(input.title), False, input.minOccurs == 0))
                self.addParameter(ParameterFile(str(input.identifier), str(input.title)))
            elif inputType == MultipleFileInput:
                pass #Not supported
            elif inputType == SelectionInput:
                self.addParameter(ParameterSelection(str(input.identifier), str(input.title), input.valList))
            elif inputType == ExtentInput:
                self.addParameter(ParameterExtent(str(input.identifier), str(input.title)))
            elif inputType == CrsInput:
                self.addParameter(ParameterCrs(str(input.identifier), "Projection", None))

        for output in self.process.outputs:
            outputType = type(output)
            if outputType == VectorOutput:
                self.addOutput(OutputVector(str(output.identifier), str(output.title)))
            elif outputType == RasterOutput:
                self.addOutput(OutputRaster(str(output.identifier), str(output.title)))
            elif outputType == StringOutput:
                self.addOutput(OutputString(str(output.identifier), str(output.title)))
Ejemplo n.º 5
0
    def defineCharacteristics(self):
        self.name = "Reproject layer"
        self.group = "Vector general tools"

        self.addParameter(ParameterVector(self.INPUT, "Input layer", ParameterVector.VECTOR_TYPE_ANY))
        self.addParameter(ParameterCrs(self.TARGET_CRS, "Target CRS", "EPSG:4326"))

        self.addOutput(OutputVector(self.OUTPUT, "Reprojected layer"))
Ejemplo n.º 6
0
 def defineCharacteristics(self):
     self.name = "Translate (convert format)"
     self.group = "[GDAL] Conversion"
     self.addParameter(ParameterRaster(translate.INPUT, "Input layer", False))
     self.addParameter(ParameterNumber(translate.OUTSIZE, "Set the size of the output file (In pixels or %)", 1, None, 100))
     self.addParameter(ParameterBoolean(translate.OUTSIZE_PERC, "Output size is a percentage of input size", True))
     self.addParameter(ParameterString(translate.NO_DATA, "Nodata value, leave as none to take the nodata value from input", "none"))
     self.addParameter(ParameterSelection(translate.EXPAND, "Expand", ["none","gray","rgb","rgba"]))
     self.addParameter(ParameterCrs(translate.SRS, "Override the projection for the output file", None))
     self.addParameter(ParameterExtent(translate.PROJWIN, "Subset based on georeferenced coordinates"))
     self.addParameter(ParameterBoolean(translate.SDS, "Copy all subdatasets of this file to individual output files", False))
     self.addParameter(ParameterString(translate.EXTRA, "Additional creation parameters", ""))
     self.addOutput(OutputRaster(translate.OUTPUT, "Output layer"))
Ejemplo n.º 7
0
 def defineCharacteristics(self):
     self.name = "Points layer from table"
     self.group = "Vector creation tools"
     self.addParameter(ParameterTable(self.INPUT, "Input layer"))
     self.addParameter(
         ParameterTableField(self.XFIELD, "X field", self.INPUT,
                             ParameterTableField.DATA_TYPE_ANY))
     self.addParameter(
         ParameterTableField(self.YFIELD, "Y field", self.INPUT,
                             ParameterTableField.DATA_TYPE_ANY))
     self.addParameter(
         ParameterCrs(self.TARGET_CRS, "Target CRS", "EPSG:4326"))
     self.addOutput(OutputVector(self.OUTPUT, "Output layer"))
Ejemplo n.º 8
0
 def testParameterExtent(self):
     param = ParameterCrs("name", "desc")        
     assert not param.setValue("EPSG:12003")        
     assert param.value ==  "EPSG:12003"
     assert param.setValue(None)
     assert param.value == param.default        
     s = param.serialize()
     param2 = ParameterCrs()
     param2.deserialize(s)        
     assert param.default == param2.default        
     assert param.description == param2.description
     assert param.name == param2.name        
Ejemplo n.º 9
0
  def defineCharacteristics(self):
    self.name = "Create grid"
    self.group = "Vector creation tools"

    self.addParameter(ParameterNumber(self.HSPACING, "Horizontal spacing", default = 10.0))
    self.addParameter(ParameterNumber(self.VSPACING, "Vertical spacing", default = 10.0))
    self.addParameter(ParameterNumber(self.WIDTH, "Width", default = 360.0))
    self.addParameter(ParameterNumber(self.HEIGHT, "Height", default = 180.0))
    self.addParameter(ParameterNumber(self.CENTERX, "Center X", default = 0.0))
    self.addParameter(ParameterNumber(self.CENTERY, "Center Y", default = 0.0))
    self.gridtype_options = ["Rectangle (line)","Rectangle (polygon)","Diamond (polygon)","Hexagon (polygon)"]
    self.addParameter(ParameterSelection(self.GRIDTYPE, "Grid type",
      self.gridtype_options, default = 0))
    self.addParameter(ParameterCrs(self.CRS, "CRS"))
    self.addOutput(OutputVector(self.SAVENAME, "Output"))
Ejemplo n.º 10
0
    def defineCharacteristics(self):
        '''Here we define the inputs and output of the algorithm, along
        with some other properties'''

        #the name that the user will see in the toolbox
        self.name = "Create new layer with selected features"

        #the branch of the toolbox under which the algorithm will appear
        self.group = "Algorithms for vector layers"

        #we add the input vector layer. It can have any kind of geometry
        #It is a mandatory (not optional) one, hence the False argument
        self.addParameter(
            ParameterVector(self.INPUT_LAYER, "Input layer",
                            ParameterVector.VECTOR_TYPE_ANY, False))
        self.addParameter(ParameterExtent("EXTENT", "EXTENT"))
        self.addParameter(ParameterCrs("CRS", "CRS"))
        # we add a vector layer as output
        self.addOutput(
            OutputVector(self.OUTPUT_LAYER,
                         "Output layer with selected features"))