[Qgis-developer] create (sub)lines from line between two points
rdmailings at duif.net
Thu Dec 18 13:06:25 PST 2014
anybody a simple (python) solution for following problem:
- given a line with 5 vertices (say W-shaped) of total 100 meter
- starting from point 0 on this line I want a set of 10 meter lines
(following the original) and x meter in between.
- the result should be y lines which follow the W
On a straight part of the line it is easy, using the interpolate
function of QgsGeometry: just find the start and end of each 10m part
and create a line in between.
BUT that fails in parts where there is a vertex in this part, the new
line will be created between the start and end, taking a 'shortcut' on
the parts of the original line where there is a vertex/hook in the line.
How can I make the 10m lines follow the original line.
I've been looking into the 'findNextVertex'-functions, but fail to
create good use of these.
Another idea I had was to 'grow' the 10m line in a lot of smaller steps,
checking everytime if there is a vertex from the original line ON the
new create one.
Anybody has a better idea?
The use case is a plugin creating trenches in longer line-segments:
after creating the 10m line, that line is buffered, so create a 'trench'.
More information about the Qgis-developer