Skip to content
Permalink
Browse files

Add v.lrs.create algorithm

  • Loading branch information
Médéric RIBREUX
Médéric RIBREUX committed Mar 12, 2016
1 parent 3a995cf commit db65371e996f6af7dfa091ca0c2949f2c5955076
@@ -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
@@ -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.
You can’t perform that action at this time.