Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add v.lrs.create algorithm
  • Loading branch information
Médéric RIBREUX committed Mar 12, 2016
1 parent 3a995cf commit db65371
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
15 changes: 15 additions & 0 deletions 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
44 changes: 44 additions & 0 deletions 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()

0 comments on commit db65371

Please sign in to comment.