Skip to content

Commit db65371

Browse files
author
Médéric RIBREUX
committed
Add v.lrs.create algorithm
1 parent 3a995cf commit db65371

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
v.lrs.create
2+
Creates Linear Reference System
3+
Vector (v.*)
4+
ParameterVector|in_lines|Input vector map containing lines|1|False
5+
ParameterVector|points|Input vector map containing reference points|0|False
6+
ParameterTableField|lidcol|Column containing line identifiers for lines|in_lines|0|False
7+
ParameterTableField|pidcol|Column containing line identifiers for points|points|0|False
8+
ParameterTableField|start_mp|Column containing milepost position for the beginning of next segment|points|0|False
9+
ParameterTableField|start_off|Column containing offset from milepost for the beginning of next segment|points|0|False
10+
ParameterTableField|end_mp|Column containing milepost position for the end of previous segment|points|0|False
11+
ParameterTableField|end_off|Column containing offset from milepost for the end of previous segment|points|0|False
12+
ParameterNumber|thresh|Maximum distance of point to line allowed|0|None|1|True
13+
OutputVector|out_lines|LRS lines
14+
OutputVector|err|LRS Errors
15+
OutputTable|rstable|RS Table
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
v_lrs_create.py
6+
---------------
7+
Date : March 2016
8+
Copyright : (C) 2016 by Médéric Ribreux
9+
Email : medspx at medspx dot fr
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Médéric Ribreux'
21+
__date__ = 'March 2016'
22+
__copyright__ = '(C) 2016, Médéric Ribreux'
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
import os
29+
30+
31+
def processOutputs(alg):
32+
# add some export commands
33+
command = 'v.build.all'
34+
alg.commands.append(command)
35+
36+
# export the SQLite table to CSV
37+
rstable = alg.getOutputValue('rstable')
38+
# I don't use db.out.ogr because it doesn't work
39+
command = 'db.select table={} separator=comma output=\"{}\" --overwrite'.format(
40+
alg.exportedLayers[rstable],
41+
rstable
42+
)
43+
alg.commands.append(command)
44+
alg.processOutputs()

0 commit comments

Comments
 (0)