2

I have a polyline layer (road) that I want to use to get a point layer with 1 km between the points.

I have tried both 'QChainage' and 'Locate points along lines' to do this. They both work, I get the points that I want. But, the problem is, the end up in a crazy order. I want them to be geographically along the road, starting with 0.

What can I do that get them in the right order? I have used 'dissolve' on my road layer, and then 'QChainage' or 'Locate points along lines'. I've also tried using GRASS v.to.points. And, they all make the points, but the order is wrong in all cases.

I use QGIS 2.10 and Windows 10. My files are in SWEREF99TM (EPSG:3006)

I read Creating equidistant points in QGIS? but I don't know any programming.

What am I missing?

2 Answers 2

1

This is something I've come across sometimes when using data from OpenStreetMap (OSM).

For example, a railway line contains a number of segments. But they don't join "head-to-tail"; some join "head-to-head" and some join "tail-to-tail".

What you have looks like this; line segments join correctly, but are going in random directions...

|----->|<---|------>|--->|<---|

What you need looks like this.. every line going in the same direction...

|----->|--->|------>|--->|--->|

When you come to run the QChainage plugin, it assumes all the lines join "head-to-tail" - they all go in the same direction. If this isn't the case, the end result is a mess.

To fix this, you might want to try the plugin Join Multiple Lines. That should automagically change line segment directions so they all point the same way.

4
  • By dissolving them you can usually merge them all... and as I understand @Sos he already did that.
    – wittich
    Nov 13, 2015 at 10:36
  • This sounds like it could be the reason behind the problem, but when I try it I get a new one. My line have intersections and then I get new lines where there shouldn't be any?
    – SoS
    Nov 26, 2015 at 13:40
  • @SoS I've found 'join multiple lines' gives odd results if the set of lines doesn't form a single route. For example, I had problems with a hiking trail which split into two and then joined back into one.
    – Steven Kay
    Nov 26, 2015 at 14:23
  • Join Multiple Lines appears to not work with QGIS 3 yet. Any alternatives that put segments into logical order? Nov 30, 2018 at 16:49
1

For grass I used the following way.

v.dissolve route output=route_dissolve column=NAME # put here a column name e.g. the streetname
v.to.points in=route_dissolve out=route_points dmax=1000

Could it be that you lines are not connected? Try it with a single line feature/route it works pretty well.

5
  • No, it's a single line feature. Perhaps I shall try making a new line to see if I can make it work on that.
    – SoS
    Nov 12, 2015 at 12:21
  • I made a new line, one single feature, and then it works. I still would like to figure out why it doesn't work on my other file.
    – SoS
    Nov 12, 2015 at 12:37
  • My guess was that the lines are divided in single parts. Is each road one polyline? Try to dissolve them first...
    – wittich
    Nov 12, 2015 at 12:43
  • I tried using dissolve before and I ended up with a single feature. I have only one road in each file. If I use select feature, the hole road gets selected.
    – SoS
    Nov 12, 2015 at 13:14
  • Then its maybe the opposite that each line has to be cut at each intersection...
    – wittich
    Nov 12, 2015 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.