def processOutputParameterToken(self, token): out = None if token.lower().strip().startswith('raster'): out = OutputRaster() elif token.lower().strip().startswith('vector'): out = OutputVector() elif token.lower().strip().startswith('table'): out = OutputTable() elif token.lower().strip().startswith('html'): out = OutputHTML() elif token.lower().strip().startswith('file'): out = OutputFile() subtokens = token.split(' ') if len(subtokens) > 2: out.ext = subtokens[2] elif token.lower().strip().startswith('directory'): out = OutputDirectory() elif token.lower().strip().startswith('number'): out = OutputNumber() elif token.lower().strip().startswith('string'): out = OutputString() return out
def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm( 'Peuker Douglas (multifile)') self.cmdName = 'peukerdouglas' self.group, self.i18n_group = self.trAlgorithm( 'Stream Network Analysis tools') self.addParameter( ParameterFile(self.ELEVATION_GRID, self.tr('Elevation Grid'), True, False)) self.addParameter( ParameterNumber(self.CENTER_WEIGHT, self.tr('Center Smoothing Weight'), 0, None, 0.4)) self.addParameter( ParameterNumber(self.SIDE_WEIGHT, self.tr('Side Smoothing Weight'), 0, None, 0.1)) self.addParameter( ParameterNumber(self.DIAGONAL_WEIGHT, self.tr('Diagonal Smoothing Weight'), 0, None, 0.05)) self.addOutput( OutputDirectory(self.STREAM_SOURCE_GRID, self.tr('Stream Source Grid')))
def defineCharacteristics(self): self.addParameter( ParameterVector(self.VECTOR, self.tr('Input point layer'), [dataobjects.TYPE_VECTOR_POINT])) self.addParameter( ParameterTableField(self.GROUP_FIELD, self.tr('Group field'), self.VECTOR)) self.addParameter( ParameterTableField(self.ORDER_FIELD, self.tr('Order field'), self.VECTOR)) self.addParameter( ParameterString( self.DATE_FORMAT, self.tr('Date format (if order field is DateTime)'), '', optional=True)) #self.addParameter(ParameterNumber( # self.GAP_PERIOD, # 'Gap period (if order field is DateTime)', 0, 60, 0)) self.addOutput( OutputVector(self.OUTPUT_LINES, self.tr('Paths'), datatype=[dataobjects.TYPE_VECTOR_LINE])) self.addOutput(OutputDirectory(self.OUTPUT_TEXT, self.tr('Directory')))
def __init__(self): super().__init__() # Required parameters self.addParameter( ParameterMultipleInput(self.INPUT, self.tr('Input layers'), dataobjects.TYPE_RASTER)) # Advanced parameters params = [] params.append( ParameterString( self.PIXELSIZE, self. tr('Pixel size to be used for the output file (XSIZE YSIZE like 512 512)' ), None, False, True)) params.append( ParameterSelection(self.ALGORITHM, self.tr('Resampling algorithm'), self.ALGO, 0, False, optional=True)) params.append( ParameterCrs(self.S_SRS, self.tr('Override source CRS'), None, True)) params.append( ParameterNumber(self.PYRAMIDLEVELS, self.tr('Number of pyramids levels to build'), None, None, None, True)) params.append( ParameterBoolean(self.ONLYPYRAMIDS, self.tr('Build only the pyramids'), False, True)) params.append( ParameterSelection(self.RTYPE, self.tr('Output raster type'), self.TYPE, 5, False, optional=True)) params.append( ParameterSelection(self.FORMAT, self.tr('Output raster format'), list(GdalUtils.getSupportedRasters().keys()), 0, False, optional=True)) params.append( ParameterBoolean(self.USEDIRFOREACHROW, self.tr('Use a directory for each row'), False, True)) params.append( ParameterString( self.CSVFILE, self. tr('Name of the csv file containing the tile(s) georeferencing information' ), None, False, True)) params.append( ParameterString(self.CSVDELIM, self.tr('Column delimiter used in the CSV file'), None, False, True)) params.append( ParameterString( self.TILEINDEX, self.tr( 'name of shape file containing the result tile(s) index'), None, False, True)) params.append( ParameterString( self.TILEINDEXFIELD, self. tr('name of the attribute containing the tile name in the result shape file' ), None, False, True)) for param in params: param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced) self.addParameter(param) self.addOutput( OutputDirectory( self.TARGETDIR, self.tr('The directory where the tile result is created')))
def defineCharacteristics(self): # The name that the user will see in the toolbox self.name = 'Dynamic Time Warping (DTW)' # The branch of the toolbox under which the algorithm will appear self.group = 'Image manipulation' self.addParameter( ParameterRaster(self.REF_RASTER, self.tr('Reference image'), False)) self.addParameter( ParameterFile( self.REF_CSV, self. tr('Reference variable (1 csv with 1 value per date). Delimiter is comma : \',\'.' ), ext='csv', optional=False)) ## self.addParameter( ParameterMultipleInput(self.SYNC_RASTER, self.tr('Image(s) to sync'), ParameterMultipleInput.TYPE_RASTER, True)) # self.addParameter( ParameterFile( self.SYNC_CSV, self. tr('Sync variable (1 csv with 1 value per date). Respect the same order as the sync raster list. Delimiter is comma : \',\'.' ), ext='csv', optional=False)) # add num self.addParameter( ParameterNumber( self.N_SAMPLES, self. tr('Number of dates to resample (minimum is the number of dates of your largest dataset). -1 to use the minimum.' ), minValue=-1, default=-1)) # add num self.addParameter( ParameterNumber( self.N_SPECTRAL_BANDS, self.tr('Number of spectral bands used for each date'), minValue=1, default=4)) #MASK self.addParameter( ParameterRaster( self.MASK_RASTER, self.tr('Mask image. Each pixel > 0 is classed as nodata.'), True)) self.addParameter( ParameterNumber(self.NO_DATA, self.tr('No data value'), minValue=-10000, default=-10000)) # We add a vector layer as output self.addOutput( OutputDirectory(self.OUTPUT_FOLDER, self.tr('Output folder')))
self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, self.tr('D-Infinity Flow Direction Grid'), True, False)) self.addParameter(ParameterFile(self.PIT_FILLED_GRID, self.tr('Pit Filled Elevation Grid'), True, False)) self.addParameter(ParameterFile(self.SLOPE_GRID, self.tr('Slope Grid'), True, False)) self.addParameter(ParameterSelection(self.STAT_METHOD, self.tr('Statistical Method'), self.STATISTICS, 2)) self.addParameter(ParameterSelection(self.DIST_METHOD, self.tr('Distance Method'), self.DISTANCE, 1)) self.addParameter(ParameterNumber(self.THRESHOLD, self.tr('Proportion Threshold'), 0, None, 0.5)) self.addParameter(ParameterBoolean(self.EDGE_CONTAM, self.tr('Check for edge contamination'), True)) self.addOutput(OutputDirectory(self.DIST_UP_GRID, self.tr('D-Infinity Distance Up'))) ======= self.name, self.i18n_name = self.trAlgorithm('D-Infinity Distance Up (multifile)') self.cmdName = 'dinfdistup' self.group, self.i18n_group = self.trAlgorithm('Specialized Grid Analysis tools') self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, self.tr('D-Infinity Flow Direction Grid'), True, False)) self.addParameter(ParameterFile(self.PIT_FILLED_GRID, self.tr('Pit Filled Elevation Grid'), True, False)) self.addParameter(ParameterFile(self.SLOPE_GRID, self.tr('Slope Grid'), True, False)) self.addParameter(ParameterSelection(self.STAT_METHOD, self.tr('Statistical Method'), self.STATISTICS, 2)) self.addParameter(ParameterSelection(self.DIST_METHOD, self.tr('Distance Method'), self.DISTANCE, 1))
def defineCharacteristics(self): <<<<<<< HEAD self.name = 'Peuker Douglas (multifile)' self.cmdName = 'peukerdouglas' self.group = 'Stream Network Analysis tools' self.addParameter(ParameterFile(self.ELEVATION_GRID, self.tr('Elevation Grid'), True, False)) self.addParameter(ParameterNumber(self.CENTER_WEIGHT, self.tr('Center Smoothing Weight'), 0, None, 0.4)) self.addParameter(ParameterNumber(self.SIDE_WEIGHT, self.tr('Side Smoothing Weight'), 0, None, 0.1)) self.addParameter(ParameterNumber(self.DIAGONAL_WEIGHT, self.tr('Diagonal Smoothing Weight'), 0, None, 0.05)) self.addOutput(OutputDirectory(self.STREAM_SOURCE_GRID, self.tr('Stream Source Grid'))) ======= self.name, self.i18n_name = self.trAlgorithm('Peuker Douglas (multifile)') self.cmdName = 'peukerdouglas' self.group, self.i18n_group = self.trAlgorithm('Stream Network Analysis tools') self.addParameter(ParameterFile(self.ELEVATION_GRID, self.tr('Elevation Grid'), True, False)) self.addParameter(ParameterNumber(self.CENTER_WEIGHT, self.tr('Center Smoothing Weight'), 0, None, 0.4)) self.addParameter(ParameterNumber(self.SIDE_WEIGHT, self.tr('Side Smoothing Weight'), 0, None, 0.1)) self.addParameter(ParameterNumber(self.DIAGONAL_WEIGHT, self.tr('Diagonal Smoothing Weight'), 0, None, 0.05)) self.addOutput(OutputDirectory(self.STREAM_SOURCE_GRID,
self.cmdName = 'dinftranslimaccum' self.group = 'Specialized Grid Analysis tools' self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, self.tr('D-Infinity Flow Direction Grid'), True, False)) self.addParameter(ParameterFile(self.SUPPLY_GRID, self.tr('Supply Grid'), True, False)) self.addParameter(ParameterFile(self.CAPACITY_GRID, self.tr('Transport Capacity Grid'), True, False)) self.addParameter(ParameterVector(self.OUTLETS_SHAPE, self.tr('Outlets Shapefile'), [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter(ParameterBoolean(self.EDGE_CONTAM, self.tr('Check for edge contamination'), True)) self.addOutput(OutputDirectory(self.TRANSP_LIM_ACCUM_GRID, self.tr('Transport Limited Accumulation Grid'))) self.addOutput(OutputDirectory(self.DEPOSITION_GRID, self.tr('Deposition Grid'))) ======= self.name, self.i18n_name = self.trAlgorithm('D-Infinity Transport Limited Accumulation (multifile)') self.cmdName = 'dinftranslimaccum' self.group, self.i18n_group = self.trAlgorithm('Specialized Grid Analysis tools') self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, self.tr('D-Infinity Flow Direction Grid'), True, False)) self.addParameter(ParameterFile(self.SUPPLY_GRID, self.tr('Supply Grid'), True, False)) self.addParameter(ParameterFile(self.CAPACITY_GRID, self.tr('Transport Capacity Grid'), True, False)) self.addParameter(ParameterVector(self.OUTLETS_SHAPE, self.tr('Outlets Shapefile'),
def defineCharacteristics(self): self.addParameter(ParameterVector(self.INPUT, self.tr('Input layer'))) self.addParameter(ParameterTableField(self.FIELD, self.tr('Unique ID field'), self.INPUT)) self.addOutput(OutputDirectory(self.OUTPUT, self.tr('Output directory')))
def defineCharacteristics(self): <<<<<<< HEAD self.name = 'Slope Area Combination (multifile)' self.cmdName = 'slopearea' self.group = 'Stream Network Analysis tools' self.addParameter(ParameterFile(self.SLOPE_GRID, self.tr('Slope Grid'), True, False)) self.addParameter(ParameterFile(self.AREA_GRID, self.tr('Contributing Area Grid'), True, False)) self.addParameter(ParameterNumber(self.SLOPE_EXPONENT, self.tr('Slope Exponent'), 0, None, 2)) self.addParameter(ParameterNumber(self.AREA_EXPONENT, self.tr('Area Exponent'), 0, None, 1)) self.addOutput(OutputDirectory(self.SLOPE_AREA_GRID, self.tr('Slope Area Grid'))) ======= self.name, self.i18n_name = self.trAlgorithm('Slope Area Combination (multifile)') self.cmdName = 'slopearea' self.group, self.i18n_group = self.trAlgorithm('Stream Network Analysis tools') self.addParameter(ParameterFile(self.SLOPE_GRID, self.tr('Slope Grid'), True, False)) self.addParameter(ParameterFile(self.AREA_GRID, self.tr('Contributing Area Grid'), True, False)) self.addParameter(ParameterNumber(self.SLOPE_EXPONENT, self.tr('Slope Exponent'), 0, None, 2)) self.addParameter(ParameterNumber(self.AREA_EXPONENT, self.tr('Area Exponent'), 0, None, 1)) self.addOutput(OutputDirectory(self.SLOPE_AREA_GRID,
<<<<<<< HEAD self.name = 'Grid Network (multifile)' self.cmdName = 'gridnet' self.group = 'Basic Grid Analysis tools' self.addParameter(ParameterFile(self.D8_FLOW_DIR_GRID, self.tr('D8 Flow Direction Grid'), True, False)) self.addParameter(ParameterVector(self.OUTLETS_SHAPE, self.tr('Outlets Shapefile'), [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter(ParameterFile(self.MASK_GRID, self.tr('Mask Grid'), True, True)) self.addParameter(ParameterNumber(self.THRESHOLD, self.tr('Mask Threshold'), 0, None, 100)) self.addOutput(OutputDirectory(self.LONGEST_LEN_GRID, self.tr('Longest Upslope Length Grid'))) self.addOutput(OutputDirectory(self.TOTAL_LEN_GRID, self.tr('Total Upslope Length Grid'))) self.addOutput(OutputDirectory(self.STRAHLER_GRID, self.tr('Strahler Network Order Grid'))) ======= self.name, self.i18n_name = self.trAlgorithm('Grid Network (multifile)') self.cmdName = 'gridnet' self.group, self.i18n_group = self.trAlgorithm('Basic Grid Analysis tools') self.addParameter(ParameterFile(self.D8_FLOW_DIR_GRID, self.tr('D8 Flow Direction Grid'), True, False)) self.addParameter(ParameterVector(self.OUTLETS_SHAPE, self.tr('Outlets Shapefile'), [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter(ParameterFile(self.MASK_GRID,
self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, self.tr('D-Infinity Flow Direction Grid'), True, False)) self.addParameter(ParameterFile(self.PIT_FILLED_GRID, self.tr('Pit Filled Elevation Grid'), True, False)) self.addParameter(ParameterFile(self.STREAM_GRID, self.tr('Stream Raster Grid'), True, False)) self.addParameter(ParameterFile(self.WEIGHT_PATH_GRID, self.tr('Weight Path Grid'), True, True)) self.addParameter(ParameterSelection(self.STAT_METHOD, self.tr('Statistical Method'), self.STATISTICS, 2)) self.addParameter(ParameterSelection(self.DIST_METHOD, self.tr('Distance Method'), self.DISTANCE, 1)) self.addParameter(ParameterBoolean(self.EDGE_CONTAM, self.tr('Check for edge contamination'), True)) self.addOutput(OutputDirectory(self.DIST_DOWN_GRID, self.tr('D-Infinity Drop to Stream Grid'))) ======= self.name, self.i18n_name = self.trAlgorithm('D-Infinity Distance Down (multifile)') self.cmdName = 'dinfdistdown' self.group, self.i18n_group = self.trAlgorithm('Specialized Grid Analysis tools') self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, self.tr('D-Infinity Flow Direction Grid'), True, False)) self.addParameter(ParameterFile(self.PIT_FILLED_GRID, self.tr('Pit Filled Elevation Grid'), True, False)) self.addParameter(ParameterFile(self.STREAM_GRID, self.tr('Stream Raster Grid'), True, False)) self.addParameter(ParameterFile(self.WEIGHT_PATH_GRID, self.tr('Weight Path Grid'), True, True)) self.addParameter(ParameterSelection(self.STAT_METHOD, self.tr('Statistical Method'), self.STATISTICS, 2))
def defineCharacteristics(self): """Algorithme variable and parameters parameters""" CholeAlgorithm.defineCharacteristics(self) # The name/group that the user will see in the toolbox self.group = 'landscape metrics' self.i18n_group = self.tr('landscape metrics') self.name = 'selected multi' self.i18n_name = self.tr('selected multi') # === INPUT PARAMETERS === self.addParameter( ParameterRaster(name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc'))) self.addParameter( ParameterSelection(name=self.WINDOW_SHAPE, description=self.tr('Window shape'), options=';'.join(self.types_of_shape))) self.addParameter( ParameterFile(name=self.FRICTION_FILE, description=self.tr('Friction file'))) self.addParameter( ParameterString( name=self.WINDOW_SIZES, description=self. tr('Windows sizes (pixels) [constraint V1.0: "select only one"]' ))) self.addParameter( ParameterSelection(name=self.PIXELS_POINTS_SELECT, description=self.tr('Pixels/points selection'), options=';'.join( self.types_of_pixel_point_select))) self.addParameter( ParameterFile(name=self.PIXELS_FILE, description=self.tr('Pixels file'))) self.addParameter( ParameterFile(name=self.POINTS_FILE, description=self.tr('Points file'))) self.addParameter( ParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of mising values'), minValue=0, maxValue=100, default=100)) self.addParameter( ParameterString( name=self.METRICS, description=self.tr( 'Select metrics [constraint V1.0: "select only one"]'))) # === OUTPUT PARAMETERS === self.addOutput( OutputFile(name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), ext='properties')) self.addOutput( OutputDirectory(name=self.OUTPUT_DIR, description=self.tr('Output directory'))) self.addParameter( ParameterBoolean(name=self.OPEN_ALL_ASC, description=self.tr('Open all ascii'), default=True, optional=True))
def defineCharacteristics(self): """Algorithme variable and parameters parameters""" CholeAlgorithm.defineCharacteristics(self) # The name/group that the user will see in the toolbox self.group = 'landscape metrics' self.i18n_group = self.tr('landscape metrics') self.name = 'sliding multi' self.i18n_name = self.tr('sliding multi') # === INPUT PARAMETERS === self.addParameter( ParameterRaster(name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc'))) self.addParameter( ParameterSelection(name=self.WINDOW_SHAPE, description=self.tr('Window shape'), options=';'.join(self.types_of_shape))) self.addParameter( ParameterFile(name=self.FRICTION_FILE, description=self.tr('Friction file'))) self.addParameter( ParameterString(name=self.WINDOW_SIZES, description=self.tr('Windows sizes (pixels)'))) self.addParameter( ParameterNumber( name=self.DELTA_DISPLACEMENT, description=self.tr('Delta od displacement (pixels)'), default=1)) self.addParameter( ParameterBoolean(name=self.INTERPOLATE_VALUES_BOOL, description=self.tr('Interpolate Values'), default=False)) self.addParameter( ParameterString( name=self.FILTER, description=self.tr('Filters - Analyse only (optional)'), default='', optional=True)) self.addParameter( ParameterString( name=self.UNFILTER, default='', description=self.tr('Filters - Do not analyse (optional)'), optional=True)) self.addParameter( ParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of mising values'), minValue=0, maxValue=100, default=100)) self.addParameter( ParameterString(name=self.METRICS, description=self.tr('Select metrics'))) # === OUTPUT PARAMETERS === self.addOutput( OutputFile(name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), ext='properties')) self.addOutput( OutputDirectory(name=self.OUTPUT_DIR, description=self.tr('Output directory'))) self.addParameter( ParameterBoolean(name=self.OPEN_ALL_ASC, description=self.tr('Open all ascii'), default=True, optional=True))
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 if line == "nomodeler": self.showInModeler = False return tokens = line.split('=', 1) 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() == 'vector point': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_POINT]) elif tokens[1].lower().strip() == 'vector line': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_LINE]) elif tokens[1].lower().strip() == 'vector polygon': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_POLYGON]) 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], desc, 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('longstring'): default = tokens[1].strip()[len('longstring') + 1:] param = ParameterString(tokens[0], desc, default, multiline=True) elif tokens[1].lower().strip().startswith('crs'): default = tokens[1].strip()[len('crs') + 1:] if not default: default = 'EPSG:4326' param = ParameterCrs(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() subtokens = tokens[1].split(' ') if len(subtokens) > 2: out.ext = subtokens[2] elif tokens[1].lower().strip().startswith('output directory'): out = OutputDirectory() elif tokens[1].lower().strip().startswith('output number'): out = OutputNumber() elif tokens[1].lower().strip().startswith('output string'): out = OutputString() if param is not None: self.addParameter(param) elif out is not None: out.name = tokens[0] out.description = desc self.addOutput(out) else: raise WrongScriptException( self.tr('Could not load script: %s.\n' 'Problem with line %d', 'ScriptAlgorithm') % (self.descriptionFile or '', line))
def initAlgorithm(self, config=None): # Required parameters self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'))) # Advanced parameters params = [] params.append( ParameterSelection(self.PROFILE, self.tr('Tile cutting profile'), self.PROFILES, 0, False, optional=True)) params.append( ParameterSelection(self.RESAMPLING, self.tr('Resampling method'), self.RESAMPLINGS, 0, False, optional=True)) params.append( ParameterCrs( self.S_SRS, self. tr('The spatial reference system used for the source input data' ), None, True)) params.append( ParameterString(self.ZOOM, self.tr('Zoom levels to render'), None, False, True)) params.append( ParameterBoolean( self.RESUME, self.tr('Resume mode, generate only missing files'), False, True)) params.append( ParameterString( self.NODATA, self.tr( 'NODATA transparency value to assign to the input data'), None, False, True)) params.append( ParameterBoolean( self.FORCEKML, self. tr('Generate KML for Google Earth - default for "geodetic" profile and "raster" in EPSG:4326' ), False, True)) params.append( ParameterBoolean( self.NOKML, self.tr( 'Avoid automatic generation of KML files for EPSG:4326'), False, True)) params.append( ParameterString( self.URL, self. tr('URL address where the generated tiles are going to be published' ), None, False, True)) params.append( ParameterSelection(self.WEBVIEWER, self.tr('Web viewer to generate'), self.WEBVIEWERS, 0, False, optional=True)) params.append( ParameterString(self.TITLE, self.tr('Title of the map'), None, False, True)) params.append( ParameterString(self.COPYRIGHT, self.tr('Copyright for the map'), None, False, True)) params.append( ParameterString( self.GOOGLEKEY, self. tr('Google Maps API key from http://code.google.com/apis/maps/signup.html' ), None, False, True)) params.append( ParameterString( self.BINGKEY, self.tr( 'Bing Maps API key from https://www.bingmapsportal.com/'), None, False, True)) for param in params: param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced) self.addParameter(param) self.addOutput( OutputDirectory( self.OUTPUTDIR, self.tr('The directory where the tile result is created')))
def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('Retile') self.group, self.i18n_group = self.trAlgorithm('[GDAL] Miscellaneous') # Required parameters self.addParameter( ParameterMultipleInput(self.INPUT, self.tr('Input layers'), ParameterMultipleInput.TYPE_RASTER)) # Advanced parameters params = [] params.append( ParameterString( self.PIXELSIZE, self. tr('Pixel size to be used for the output file (XSIZE YSIZE like 512 512)' ), None, False, True)) params.append( ParameterSelection(self.ALGORITHM, self.tr('Resampling algorithm'), self.ALGO, 0, False, True)) params.append( ParameterCrs(self.S_SRS, self.tr('Override source CRS'), None, True)) params.append( ParameterNumber(self.PYRAMIDLEVELS, self.tr('Number of pyramids levels to build'), None, None, None, True)) params.append( ParameterBoolean(self.ONLYPYRAMIDS, self.tr('Build only the pyramids'), False, True)) params.append( ParameterSelection(self.RTYPE, self.tr('Output raster type'), self.TYPE, 5, False, True)) params.append( ParameterSelection(self.FORMAT, self.tr('Output raster format'), GdalUtils.getSupportedRasters().keys(), 0, False, True)) params.append( ParameterBoolean(self.USEDIRFOREACHROW, self.tr('Use a directory for each row'), False, True)) params.append( ParameterString( self.CSVFILE, self. tr('Name of the csv file containing the tile(s) georeferencing information' ), None, False, True)) params.append( ParameterString(self.CSVDELIM, self.tr('Column delimiter used in the CSV file'), None, False, True)) params.append( ParameterString( self.TILEINDEX, self.tr( 'name of shape file containing the result tile(s) index'), None, False, True)) params.append( ParameterString( self.TILEINDEXFIELD, self. tr('name of the attribute containing the tile name in the result shape file' ), None, False, True)) for param in params: param.isAdvanced = True self.addParameter(param) self.addOutput( OutputDirectory( self.TARGETDIR, self.tr('The directory where the tile result is created')))