Given a line vector layer, we need to identify the segment center of each line in the layer. Segment center is linear layer from the line, as explained in the picture below:
Proposed solution
The algorithm should be something like this
def get_segment_center(line):
"""Return the linear center of a segment.
We can find the center segment by finding the point that has half distance from start point.
:param line: A line from a vector layer.
:type line: QgsLine
:returns: A linear center of the line.
:rtype: QgsPoint
"""
Problem
Given a line vector layer, we need to identify the segment center of each line in the layer. Segment center is linear layer from the line, as explained in the picture below:
Proposed solution
The algorithm should be something like this
Expected outcome
A point in the center segment of the line.