Bug report #7073

Intersection Tool Produces two Intersection points on the same position when performed on Same Layer

Added by Sibi Prabakaran over 8 years ago. Updated over 4 years ago.

Assignee:Sibi Prabakaran
Affected QGIS version:master Regression?:
Operating System:Ubuntu Linux Easy fix?:
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16157


Platform Used: Ubuntu Linux 32-bit

The Intersection tool when performed on the same layer produces two intersection points overlapping each other.

Their attribute table data for the intersected points is something like this:

doIntersectLines.diff Magnifier (1.91 KB) Daniel Vaz, 2013-07-05 10:46 AM

Related issues

Related to QGIS Application - Bug report #7021: Line Intersection tool produces error when using jus one ... Closed 2013-01-21

Associated revisions

Revision 56210eb0
Added by Nathan Woodrow about 8 years ago

Merge pull request #711 from ddanielvaz/bugfixes

Bugfixes for fTools.

Fix #8218
Fix #8069
Fix #7073


#1 Updated by Sibi Prabakaran over 8 years ago

  • % Done changed from 0 to 100

#2 Updated by Matthias Kuhn about 8 years ago

  • Status changed from Open to Feedback

Is this bugreport still valid after #7021 has been fixed?

#3 Updated by Giovanni Manghi about 8 years ago

Matthias Kuhn wrote:

Is this bugreport still valid after #7021 has been fixed?

yes, because the result layer is empty.

Moreover if the tool is run using two different shapes I get

Traceback (most recent call last):
File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\fTools\\tools\\doIntersectLines.py", line 96, in accept
self.compute(line1, line2, field1, field2, outPath, self.progressBar)
File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\fTools\\tools\\doIntersectLines.py", line 169, in compute
outFeat.setAttribute(0, v1)
KeyError: '0'

I get the same error when running the tool using postgis layers.

#4 Updated by Daniel Vaz about 8 years ago

When lines are in the same layer, I think that there is a problem using the same provider to iterate over both lines. There is a strange behaviour, I don't know why, but it looks like that code:


overriden the provider1, so in the loop:

while provider1.nextFeature(inFeat):

the attribute map of each feature (inFeat.attributeMap()) is an empty dict.

The patch attached includes the patch proposed by Sibi and adds a HACK that solves the problem, but it's not the correct way, I think.

#5 Updated by Daniel Vaz about 8 years ago

The hack that solves the problem, is added the following two lines before the while loop.

allAttrs = provider1.attributeIndexes()
while provider1.nextFeature(inFeat):

#7 Updated by Nathan Woodrow about 8 years ago

  • Status changed from Feedback to Closed

#8 Updated by Giovanni Manghi over 4 years ago

The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.

Also available in: Atom PDF