kartoza / stream_feature_extractor

A QGIS plugin to extract stream features (wells, sinks, confluences etc.) from a stream network
GNU General Public License v2.0
6 stars 9 forks source link

We need to be able to identify segment centers #18

Closed timlinux closed 10 years ago

timlinux commented 10 years ago

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: stream-center - new page

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
    """

Expected outcome

A point in the center segment of the line.