Skip to content
Permalink
Browse files

[BUG] Avoid trying to split a line with itself

  • Loading branch information
bstroebl authored and m-kuhn committed Mar 14, 2016
1 parent 5676430 commit bbcacfbfbd07311b6a96cdd7717898564c81347e
Showing with 7 additions and 0 deletions.
  1. +7 −0 python/plugins/processing/algs/qgis/SplitLinesWithLines.py
@@ -5,6 +5,7 @@
SplitLines.py
---------------------
Date : November 2014
Revised : February 2016
Copyright : (C) 2014 by Bernhard Ströbl
Email : bernhard dot stroebl at jena dot de
***************************************************************************
@@ -55,6 +56,7 @@ def processAlgorithm(self, progress):
layerA = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_A))
layerB = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_B))

sameLayer = self.getParameterValue(self.INPUT_A) == self.getParameterValue(self.INPUT_B)
fieldList = layerA.pendingFields()

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fieldList,
@@ -79,6 +81,11 @@ def processAlgorithm(self, progress):
for i in lines:
request = QgsFeatureRequest().setFilterFid(i)
inFeatB = layerB.getFeatures(request).next()
# check if trying to self-intersect
if sameLayer:
if inFeatA.id() == inFeatB.id():
continue

splitGeom = QgsGeometry(inFeatB.geometry())

if inGeom.intersects(splitGeom):

0 comments on commit bbcacfb

Please sign in to comment.
You can’t perform that action at this time.