Skip to content

Commit 1ebd768

Browse files
author
Médéric RIBREUX
committed
Add v.lrs.where algorithm
1 parent db65371 commit 1ebd768

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
v.lrs.where
2+
Finds line id and real km+offset for given points in vector map using linear reference system.
3+
Vector (v.*)
4+
ParameterVector|lines|Input vector map containing lines|1|False
5+
ParameterVector|points|Input vector map containing reference points|0|False
6+
ParameterTable|rstable|Name of the reference system table|False
7+
ParameterNumber|thresh|Maximum distance of point to line allowed|0|None|1000|True
8+
OutputFile|output|LRS Points

python/plugins/processing/algs/grass7/ext/v_lrs_create.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ def processOutputs(alg):
4141
rstable
4242
)
4343
alg.commands.append(command)
44+
command = 'echo \"Integer\",\"Integer\",\"Integer\",\"Real\",\"Real\",\"Real\",\"Real\",\"Real\",\"Real\",\"Real\" > \"{}t\"'.format(rstable)
45+
alg.commands.append(command)
4446
alg.processOutputs()
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
v_lrs_where.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+
29+
def processInputs(alg):
30+
# We need to import the rstable
31+
rstable = alg.getParameterValue('rstable')
32+
if rstable in alg.exportedLayers.keys():
33+
return
34+
alg.exportedLayers[rstable] = alg.getTempFilename()
35+
command = 'db.in.ogr input=\"{}\" output={} --overwrite'.format(
36+
rstable,
37+
alg.exportedLayers[rstable]
38+
)
39+
alg.commands.append(command)
40+
alg.processInputs()
41+
42+
43+
def processCommand(alg):
44+
command = 'v.lrs.where lines={} points={} rstable={} thresh={} > {} --overwrite'.format(
45+
alg.exportedLayers[alg.getParameterValue('lines')],
46+
alg.exportedLayers[alg.getParameterValue('points')],
47+
alg.exportedLayers[alg.getParameterValue('rstable')],
48+
alg.getParameterValue('thresh'),
49+
alg.getOutputValue('output')
50+
)
51+
alg.commands.append(command)

0 commit comments

Comments
 (0)