Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
qgib opened this issue Jan 29, 2013 · 8 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@qgib
Copy link
Contributor

qgib commented Jan 29, 2013

Author Name: Sibi Prabakaran (Sibi Prabakaran)
Original Redmine Issue: 7073
Affected QGIS version: master
Redmine category:processing/qgis
Assignee: Sibi Prabakaran


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 issue(s): #16115 (relates)
Redmine related issue(s): 7021


@qgib
Copy link
Contributor Author

qgib commented Jan 29, 2013

Author Name: Sibi Prabakaran (Sibi Prabakaran)


Pull Request submitted in #414


  • done_ratio was changed from 0 to 100

@qgib
Copy link
Contributor Author

qgib commented Jul 2, 2013

Author Name: Matthias Kuhn (@m-kuhn)


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


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Jul 4, 2013

Author Name: Giovanni Manghi (@gioman)


Matthias Kuhn wrote:

Is this bugreport still valid after #16115 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.

@qgib
Copy link
Contributor Author

qgib commented Jul 5, 2013

Author Name: Daniel Vaz (Daniel Vaz)


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.


  • 5952 was configured as doIntersectLines.diff

@qgib
Copy link
Contributor Author

qgib commented Jul 5, 2013

Author Name: Daniel Vaz (Daniel Vaz)


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):

@qgib
Copy link
Contributor Author

qgib commented Jul 6, 2013

Author Name: Daniel Vaz (Daniel Vaz)


See pull request 702. #702

@qgib
Copy link
Contributor Author

qgib commented Jul 10, 2013

Author Name: Nathan Woodrow (@NathanW2)


Fixed in changeset "56210eb0b5c7914d246b1c82ad48e676b00b6557".


  • status_id was changed from Feedback to Closed

@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


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

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms labels May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

1 participant