[GIS] How to create point labels from midpoints of road polylines in QGIS

centroidsdissolveqgis

I have a road polyline layer (singlepart ie has several features per road, grouped by an id field), and i want to (after merging the parts) find the mid point of the resulting lines. This is for roads geolocation.

The problem is that the QGIS' dissolve function only works on polygons.

I've tried:
a) mmqgis plugin "create label layer" (handles multiparts nicely)
b) buffer road lines to 1m then dissolve by roadid, then ftools centroids

Both of which give a 'sort of' result, but the main problem is that the point is not actually on the road line. Is there a way to either force polygon centroids to be within the buffer polygon, or alternatively, some way to actually join the polylines and find mid points directly.

Note that while there are (a small number of) 'Y' shaped lines, most of the multipart lines start and end at the same place, (maybe gridifyed to 1cm).

Best Answer

You can join the polylines by editing the layer, selecting all the lines (all of them or by attribute) and then click the 'Merge Features' tool:

enter image description here

To find the midpoint, calculate distance of lines, then use point along line tools to put a point at distance/2 along each line.

Related Question