コード例 #1
0
ファイル: VectorSplit.py プロジェクト: haga5/QGIS
    def initAlgorithm(self, config=None):
        self.addParameter(
            QgsProcessingParameterFeatureSource(self.INPUT,
                                                self.tr('Input layer')))

        self.addParameter(
            QgsProcessingParameterField(self.FIELD, self.tr('Unique ID field'),
                                        None, self.INPUT))

        self.addParameter(
            QgsProcessingParameterFolderDestination(
                self.OUTPUT, self.tr('Output directory')))

        self.addOutput(
            QgsProcessingOutputFolder(self.OUTPUT,
                                      self.tr('Output directory')))
コード例 #2
0
    def __init__(self):
        super().__init__()

        self.addParameter(
            QgsProcessingParameterFeatureSource(self.INPUT,
                                                self.tr('Input layer')))

        self.addParameter(
            QgsProcessingParameterField(self.FIELD, self.tr('Unique ID field'),
                                        None, self.INPUT))

        self.addParameter(
            QgsProcessingParameterFolderOutput(self.OUTPUT,
                                               self.tr('Output directory')))

        self.addOutput(
            QgsProcessingOutputFolder(self.OUTPUT,
                                      self.tr('Output directory')))
コード例 #3
0
    def initAlgorithm(self, config=None):
        self.methods = (
            (self.tr('Nearest neighbour'), 'near'),
            (self.tr('Bilinear'), 'bilinear'),
            (self.tr('Cubic'), 'cubic'),
            (self.tr('Cubic spline'), 'cubicspline'),
            (self.tr('Lanczos windowed sinc'), 'lanczos'),
        )

        self.addParameter(
            QgsProcessingParameterMultipleLayers(self.INPUT,
                                                 self.tr('Input files'),
                                                 QgsProcessing.TypeRaster))
        self.addParameter(
            QgsProcessingParameterNumber(
                self.TILE_SIZE_X,
                self.tr('Tile width'),
                type=QgsProcessingParameterNumber.Integer,
                minValue=0,
                defaultValue=256))
        self.addParameter(
            QgsProcessingParameterNumber(
                self.TILE_SIZE_Y,
                self.tr('Tile height'),
                type=QgsProcessingParameterNumber.Integer,
                minValue=0,
                defaultValue=256))
        self.addParameter(
            QgsProcessingParameterNumber(
                self.OVERLAP,
                self.tr('Overlap in pixels between consecutive tiles'),
                type=QgsProcessingParameterNumber.Integer,
                minValue=0,
                defaultValue=0))
        self.addParameter(
            QgsProcessingParameterNumber(
                self.LEVELS,
                self.tr('Number of pyramids levels to build'),
                type=QgsProcessingParameterNumber.Integer,
                minValue=0,
                defaultValue=1))

        params = []
        params.append(
            QgsProcessingParameterCrs(
                self.SOURCE_CRS,
                self.tr('Source coordinate reference system'),
                optional=True))
        params.append(
            QgsProcessingParameterEnum(self.RESAMPLING,
                                       self.tr('Resampling method'),
                                       options=[i[0] for i in self.methods],
                                       allowMultiple=False,
                                       defaultValue=0))
        params.append(
            QgsProcessingParameterString(
                self.DELIMITER,
                self.tr('Column delimiter used in the CSV file'),
                defaultValue=';',
                optional=True))

        options_param = QgsProcessingParameterString(
            self.OPTIONS,
            self.tr('Additional creation parameters'),
            defaultValue='',
            optional=True)
        options_param.setMetadata({
            'widget_wrapper': {
                'class':
                'processing.algs.gdal.ui.RasterOptionsWidget.RasterOptionsWidgetWrapper'
            }
        })
        params.append(options_param)

        params.append(
            QgsProcessingParameterEnum(self.DATA_TYPE,
                                       self.tr('Output data type'),
                                       self.TYPES,
                                       allowMultiple=False,
                                       defaultValue=5))

        params.append(
            QgsProcessingParameterBoolean(self.ONLY_PYRAMIDS,
                                          self.tr('Build only the pyramids'),
                                          defaultValue=False))
        params.append(
            QgsProcessingParameterBoolean(
                self.DIR_FOR_ROW,
                self.tr('Use separate directory for each tiles row'),
                defaultValue=False))

        for param in params:
            param.setFlags(param.flags()
                           | QgsProcessingParameterDefinition.FlagAdvanced)
            self.addParameter(param)

        self.addParameter(
            QgsProcessingParameterFolderDestination(
                self.OUTPUT, self.tr('Output directory')))

        self.addOutput(
            QgsProcessingOutputFolder(self.OUTPUT,
                                      self.tr('Output directory')))

        output_csv_param = QgsProcessingParameterFileDestination(
            self.OUTPUT_CSV,
            self.tr(
                'CSV file containing the tile(s) georeferencing information'),
            'CSV files (*.csv)',
            optional=True)
        output_csv_param.setCreateByDefault(False)
        self.addParameter(output_csv_param)
コード例 #4
0
    def initAlgorithm(self, config=None):
        self.profiles = ((self.tr('Mercator'), 'mercator'),
                         (self.tr('Geodetic'), 'geodetic'),
                         (self.tr('Raster'), 'raster'))

        self.methods = ((self.tr('Average'), 'average'),
                        (self.tr('Nearest neighbour'), 'near'),
                        (self.tr('Bilinear'), 'bilinear'),
                        (self.tr('Cubic'), 'cubic'),
                        (self.tr('Cubic spline'), 'cubicspline'),
                        (self.tr('Lanczos windowed sinc'), 'lanczos'),
                        (self.tr('Antialias'), 'antialias'))

        self.viewers = ((self.tr('All'), 'all'),
                        (self.tr('GoogleMaps'), 'google'),
                        (self.tr('OpenLayers'), 'openlayers'),
                        (self.tr('Leaflet'), 'leaflet'),
                        (self.tr('None'), 'none'))

        self.addParameter(QgsProcessingParameterRasterLayer(self.INPUT, self.tr('Input layer')))
        self.addParameter(QgsProcessingParameterEnum(self.PROFILE,
                                                     self.tr('Tile cutting profile'),
                                                     options=[i[0] for i in self.profiles],
                                                     allowMultiple=False,
                                                     defaultValue=0))
        self.addParameter(QgsProcessingParameterString(self.ZOOM,
                                                       self.tr('Zoom levels to render'),
                                                       defaultValue='',
                                                       optional=True))
        self.addParameter(QgsProcessingParameterEnum(self.VIEWER,
                                                     self.tr('Web viewer to generate'),
                                                     options=[i[0] for i in self.viewers],
                                                     allowMultiple=False,
                                                     defaultValue=0))
        self.addParameter(QgsProcessingParameterString(self.TITLE,
                                                       self.tr('Title of the map'),
                                                       optional=True))
        self.addParameter(QgsProcessingParameterString(self.COPYRIGHT,
                                                       self.tr('Copyright of the map'),
                                                       optional=True))

        params = []
        params.append(QgsProcessingParameterEnum(self.RESAMPLING,
                                                 self.tr('Resampling method'),
                                                 options=[i[0] for i in self.methods],
                                                 allowMultiple=False,
                                                 defaultValue=0))
        params.append(QgsProcessingParameterCrs(self.SOURCE_CRS,
                                                self.tr('The spatial reference system used for the source input data'),
                                                optional=True))
        params.append(QgsProcessingParameterNumber(self.NODATA,
                                                   self.tr('Transparency value to assign to the input data'),
                                                   type=QgsProcessingParameterNumber.Double,
                                                   defaultValue=0,
                                                   optional=True))
        params.append(QgsProcessingParameterString(self.URL,
                                                   self.tr('URL address where the generated tiles are going to be published'),
                                                   optional=True))
        params.append(QgsProcessingParameterString(self.GOOGLE_KEY,
                                                   self.tr('Google Maps API key (http://code.google.com/apis/maps/signup.html)'),
                                                   optional=True))
        params.append(QgsProcessingParameterString(self.BING_KEY,
                                                   self.tr('Bing Maps API key (https://www.bingmapsportal.com/)'),
                                                   optional=True))
        params.append(QgsProcessingParameterBoolean(self.RESUME,
                                                    self.tr('Generate only missing files'),
                                                    defaultValue=False))
        params.append(QgsProcessingParameterBoolean(self.KML,
                                                    self.tr('Generate KML for Google Earth'),
                                                    defaultValue=False))
        params.append(QgsProcessingParameterBoolean(self.NO_KML,
                                                    self.tr('Avoid automatic generation of KML files for EPSG:4326'),
                                                    defaultValue=False))
        for param in params:
            param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
            self.addParameter(param)

        self.addParameter(QgsProcessingParameterFolderDestination(self.OUTPUT,
                                                                  self.tr('Output directory')))

        self.addOutput(QgsProcessingOutputFolder(self.OUTPUT, self.tr('Output directory')))