Bug report #7073
Intersection Tool Produces two Intersection points on the same position when performed on Same Layer
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Sibi Prabakaran | ||
Category: | Processing/QGIS | ||
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 |
Description
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:
1,2
2,1
Related issues
Associated revisions
History
#1 Updated by Sibi Prabakaran almost 12 years ago
- % Done changed from 0 to 100
Pull Request submitted in https://github.com/qgis/Quantum-GIS/pull/414
#2 Updated by Matthias Kuhn over 11 years ago
- Status changed from Open to Feedback
Is this bugreport still valid after #7021 has been fixed?
#3 Updated by Giovanni Manghi over 11 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 over 11 years ago
- File doIntersectLines.diff added
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:
provider2.select(allAttrs)
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 over 11 years ago
The hack that solves the problem, is added the following two lines before the while loop.
allAttrs = provider1.attributeIndexes() provider1.select(allAttrs) while provider1.nextFeature(inFeat):
#6 Updated by Daniel Vaz over 11 years ago
See pull request 702. https://github.com/qgis/Quantum-GIS/pull/702
#7 Updated by Nathan Woodrow over 11 years ago
- Status changed from Feedback to Closed
Fixed in changeset 56210eb0b5c7914d246b1c82ad48e676b00b6557.
#8 Updated by Giovanni Manghi over 7 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.