Skip to content

Commit

Permalink
Merge pull request #36645 from alexbruy/r-tileset
Browse files Browse the repository at this point in the history
fix r.tileset Processing GRASS algorithm
  • Loading branch information
alexbruy committed May 25, 2020
2 parents 97d0988 + 683f69c commit a20fe6f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
4 changes: 4 additions & 0 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -42,6 +42,7 @@
QgsProcessingAlgorithm,
QgsProcessingParameterDefinition,
QgsProcessingException,
QgsProcessingParameterCrs,
QgsProcessingParameterExtent,
QgsProcessingParameterEnum,
QgsProcessingParameterNumber,
Expand Down Expand Up @@ -633,6 +634,9 @@ def processCommand(self, parameters, context, feedback, delOutputs=False):
continue
else:
value = '{},{}'.format(v[0], v[1])
elif isinstance(param, QgsProcessingParameterCrs):
if self.parameterAsCrs(parameters, paramName, context):
value = '"{}"'.format(self.parameterAsCrs(parameters, paramName, context).toProj())
# For everything else, we assume that it is a string
else:
value = '"{}"'.format(
Expand Down
Expand Up @@ -11,4 +11,4 @@ QgsProcessingParameterNumber|overlap|Number of cells tiles should overlap in eac
QgsProcessingParameterString|separator|Output field separator|pipe|False|True
*QgsProcessingParameterBoolean|-g|Produces shell script output|False
*QgsProcessingParameterBoolean|-w|Produces web map server query string output|False
QgsProcessingParameterFileDestination|output|Tileset|Txt files (*.txt)|None|False
QgsProcessingParameterFileDestination|html|Tileset|HTML files (*.html)|None|False
28 changes: 28 additions & 0 deletions python/plugins/processing/algs/grass7/ext/r_tileset.py
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
r_proj.py
---------
Date : October 2017
Copyright : (C) 2017 by Médéric Ribreux
Email : medspx at medspx dot fr
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Médéric Ribreux'
__date__ = 'October 2017'
__copyright__ = '(C) 2017, Médéric Ribreux'


def processOutputs(alg, parameters, context, feedback):
crs = alg.parameterAsCrs(parameters, 'sourceproj', context)

alg.commands.insert(0, 'g.proj -c proj4="{}"'.format(crs.toProj()))
@@ -0,0 +1 @@
1.0|0.0|1.0|1.0|1|2
Expand Up @@ -1595,3 +1595,22 @@ tests:
rules:
- '1|1|0|344550|6693650|344550|6693650'
- '1|3|100|352650|6693650|352750|6693650'

- algorithm: grass7:r.tileset
name: GRASS 7 r.tileset
params:
-g: false
-w: false
destscale: 1.0
maxcols: 1024
maxrows: 2048
overlap: 0
separator: pipe
sourceproj: EPSG:4326
sourcescale: 1.0
results:
html:
name: expected/grass7/r_tileset.html
type: regex
rules:
- '1.0|0.0|1.0|1.0|1|2'

0 comments on commit a20fe6f

Please sign in to comment.