diff --git a/python/plugins/processing/algs/grass7/description/v.lrs.create.txt b/python/plugins/processing/algs/grass7/description/v.lrs.create.txt new file mode 100644 index 00000000000..e9bd9e317c1 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/v.lrs.create.txt @@ -0,0 +1,15 @@ +v.lrs.create +Creates Linear Reference System +Vector (v.*) +ParameterVector|in_lines|Input vector map containing lines|1|False +ParameterVector|points|Input vector map containing reference points|0|False +ParameterTableField|lidcol|Column containing line identifiers for lines|in_lines|0|False +ParameterTableField|pidcol|Column containing line identifiers for points|points|0|False +ParameterTableField|start_mp|Column containing milepost position for the beginning of next segment|points|0|False +ParameterTableField|start_off|Column containing offset from milepost for the beginning of next segment|points|0|False +ParameterTableField|end_mp|Column containing milepost position for the end of previous segment|points|0|False +ParameterTableField|end_off|Column containing offset from milepost for the end of previous segment|points|0|False +ParameterNumber|thresh|Maximum distance of point to line allowed|0|None|1|True +OutputVector|out_lines|LRS lines +OutputVector|err|LRS Errors +OutputTable|rstable|RS Table diff --git a/python/plugins/processing/algs/grass7/ext/v_lrs_create.py b/python/plugins/processing/algs/grass7/ext/v_lrs_create.py new file mode 100644 index 00000000000..8f0a8265049 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/v_lrs_create.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + v_lrs_create.py + --------------- + Date : March 2016 + Copyright : (C) 2016 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__ = 'March 2016' +__copyright__ = '(C) 2016, Médéric Ribreux' + +# This will get replaced with a git SHA1 when you do a git archive + +__revision__ = '$Format:%H$' + +import os + + +def processOutputs(alg): + # add some export commands + command = 'v.build.all' + alg.commands.append(command) + + # export the SQLite table to CSV + rstable = alg.getOutputValue('rstable') + # I don't use db.out.ogr because it doesn't work + command = 'db.select table={} separator=comma output=\"{}\" --overwrite'.format( + alg.exportedLayers[rstable], + rstable + ) + alg.commands.append(command) + alg.processOutputs()