Exemple #1
0
    def initAlgorithm(self, config=None):
        self.add_top_parameters()

        param = QgsProcessingParameterString(self.AREA, tr('Around the area'), optional=False)
        help_string = tr(
            'The name of a place, a first query to the Nominatim API will be executed to fetch the OSM ID. '
            'A WKT Point string is accepted as well.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)

        param = QgsProcessingParameterNumber(
            self.DISTANCE, tr('Distance (meters)'), defaultValue=1000, minValue=1)
        help_string = tr(
            'The distance to use when doing the buffering around the named area. The distance must be in '
            'meters.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)

        self.add_bottom_parameters()
Exemple #2
0
    def add_top_parameters(self):
        """Set up the parameters."""
        super().add_top_parameters()

        param = QgsProcessingParameterString(
            self.KEY, tr('Key, default to all keys'), optional=True
        )
        help_string = tr(
            'The OSM key to use. It can be empty and it will default to all keys. '
            'Multiple keys can be ask by adding the separator \',\' between each key. '
            'In this case make sure the number of keys match the number of values'
        )
        param.setHelp(help_string)
        self.addParameter(param)

        param = QgsProcessingParameterString(
            self.VALUE, tr('Value, default to all values'), optional=True
        )
        help_string = tr(
            'The OSM value to use. It can be empty and it will default to all values.'
            'Multiple values can be ask by adding the separator \',\' between each value. '
            'In this case make sure the number of values match the number of keys'
        )
        param.setHelp(help_string)
        self.addParameter(param)
Exemple #3
0
    def add_top_parameters(self):
        """Set up the parameter."""
        super().add_top_parameters()

        param = QgsProcessingParameterString(self.AREA, tr('Inside the area'), optional=False)
        help_string = tr(
            'The name of the area. '
            'This will make a first query to the Nominatim API to fetch the OSM ID.'
        )
        param.setHelp(help_string)
        self.addParameter(param)
Exemple #4
0
    def add_top_parameters(self):
        """Set up the parameters."""
        super().add_top_parameters()

        param = QgsProcessingParameterString(
            self.QUERY, tr('Query'), optional=False, multiLine=True
        )
        help_string = tr(
            'A XML or OQL query to be send to the Overpass API. It can contains some {{}} tokens.'
        )
        param.setHelp(help_string)
        self.addParameter(param)
Exemple #5
0
    def initAlgorithm(self, config=None):
        self.add_top_parameters()

        param = QgsProcessingParameterString(self.AREA, tr('Inside the area'), optional=False)
        help_string = tr(
            'The name of the area. This will make a first query to the Nominatim API to fetch the OSM ID.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)

        self.add_bottom_parameters()
Exemple #6
0
    def add_top_parameters(self):
        param = QgsProcessingParameterString(self.KEY, tr('Key, default to all keys'), optional=True)
        help_string = tr('The OSM key to use. It can be empty and it will default to all keys.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)

        param = QgsProcessingParameterString(self.VALUE, tr('Value, default to all values'), optional=True)
        help_string = tr('The OSM value to use. It can be empty and it will default to all values.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)
Exemple #7
0
    def initAlgorithm(self, config=None):
        param = QgsProcessingParameterString(self.QUERY,
                                             tr('Query'),
                                             optional=False,
                                             multiLine=True)
        help_string = tr(
            'A XML or OQL query to be send to the Overpass API. It can contains some {{}} tokens.'
        )
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)

        param = QgsProcessingParameterExtent(
            self.EXTENT,
            tr('Extent, if "{{bbox}}" in the query'),
            optional=True)
        help_string = tr(
            'If the query has a {{bbox}} token, this extent will be used for replacement.'
        )
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)

        server = get_setting('defaultOAPI',
                             OVERPASS_SERVERS[0]) + 'interpreter'
        param = QgsProcessingParameterString(self.SERVER,
                                             tr('Overpass server'),
                                             optional=False,
                                             defaultValue=server)
        param.setFlags(param.flags()
                       | QgsProcessingParameterDefinition.FlagAdvanced)
        help_string = tr(
            'The Overpass API server to use to build the encoded URL.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)

        param = QgsProcessingParameterString(
            self.AREA,
            tr('Area (if you want to override {{geocodeArea}} in the query)'),
            optional=True)
        param.setFlags(param.flags()
                       | QgsProcessingParameterDefinition.FlagAdvanced)
        help_string = tr('{{geocodeArea}} can be overridden on runtime.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addParameter(param)

        output = QgsProcessingOutputString(self.OUTPUT_URL,
                                           tr('Query as encoded URL'))
        help_string = tr(
            'The query is generated and encoded with the Overpass API URL. This output should be used in the '
            'File Downloader algorithm.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            pass
            # param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addOutput(output)

        output = QgsProcessingOutputString(self.OUTPUT_OQL_QUERY,
                                           tr('Raw query as OQL'))
        help_string = tr('The query is generated in the OQL format.')
        if Qgis.QGIS_VERSION_INT >= 31500:
            pass
            # param.setHelp(help_string)
        else:
            param.tooltip_3liz = help_string
        self.addOutput(output)