I am trying to create midpoints for a set of polylines in QGIS. My python knowledge is poor and was wondering if there was a plugin that did if for me.

I have tried using the Mean Coordinates function suggested in Creating point to center of polyline? but this returns a centroid which is sometimes off the line (especially when lines are not straight). I am essentially looking for a point that is on the line half way along.

  • What do you mean exactly with "midpoints for a set of polylines"? The points of the vertices of the medial axis for example? doc.cgal.org/latest/Straight_skeleton_2/index.html – huckfinn Mar 9 '16 at 4:41
  • I have a data set of polylines, for each polyline I would like to create (in a new layer) a set of points located on the lines at exactly half their length. If I had 100m polyline the point would be located on the line at 50m from the start. – Tarks Mar 10 '16 at 0:04
  • What do you mean exactly with the term polyline. A polygon is, in OGC terms, an areal data structure and its border is a circular buffer . So it is diffucult to say what is the mid point because of is in-determined start- & end point on that ring. You want to split a set of linestrings (OGC terms), which a spatial linear buffer with a start & end point and length, in two parts with a equal length? (.. look at geometry primitives 2d in: en.wikipedia.org/wiki/Well-known_text) – huckfinn Mar 10 '16 at 8:21
  • Sorry I was using MapInfo language I now assume. I am looking for the midpoints of a linestrings. – Tarks Mar 14 '16 at 20:42

There is a GDAL tool Points along lines (in Processing Toolbox | GDAL | Vector geoprocessing).

enter image description here

Start this tool, then set the Distance from line start represented as fraction of line length parameter to 0.5.

enter image description here

This 0.5, being the fraction, puts a point at the middle of the line. For you most important part of this tool is that the points are placed on the line(s).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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