Bug report #4761

Distance matrix: k becomes k-1 when working with one layer.

Added by Borys Jurgiel over 5 years ago. Updated 5 months ago.

Status:Closed
Priority:High
Assignee:-
Category:Processing/QGIS
Affected QGIS version:master Regression?:
Operating System: Easy fix?:
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No

Description

In order to replicate: use one layer (target point layer = input point layer), and k=2. Run any analysis.
It finds k=2 points: the input point itself and a second point. The first point is (correctly) dropped, so k becomes 1 instead of 2.

Associated revisions

Revision 580b9474
Added by Borys Jurgiel about 4 years ago

Merge pull request #769 from vinayan/topol

Fix #5181,#4761 - Ftools-Distance Matrix

History

#1 Updated by Borys Jurgiel over 5 years ago

  • Estimated time set to 0.50
  • Priority changed from Normal to 6

I set priority to Urgent, as it produces false results.

#2 Updated by Borys Jurgiel over 5 years ago

  • Crashes QGIS or corrupts data changed from No to Yes

#3 Updated by Borys Jurgiel over 5 years ago

  • Subject changed from Distance matrix turns k into k-1 when working with one layer. to Distance matrix: k becomes k-1 when working with one layer.

#4 Updated by Giovanni Manghi over 5 years ago

  • Priority changed from 6 to High

#5 Updated by Paolo Cavallini over 5 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0

#6 Updated by Giovanni Manghi over 5 years ago

  • Assignee deleted (cfarmer -)

#7 Updated by Salvatore Larosa over 5 years ago

  • Crashes QGIS or corrupts data changed from Yes to No
  • Status changed from Open to Feedback

for me works fine as well as QGIS doesn't crash!

Can you share your testcase?

#8 Updated by Paolo Cavallini about 5 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#9 Updated by Giovanni Manghi almost 5 years ago

  • Resolution set to worksforme
  • Status changed from Feedback to Closed

Closing for lack of feedback. Please reopen if necessary.

#10 Updated by vinayan Parameswaran over 4 years ago

This is a bug that has been there since Qgis 1.8. I can't share a shapefile now. In fact, it will not work for any file.

How to replicate:

  • Create a point layer with 4 point features.Populate Id field with unique values.
  • In distance matrix dialog, set input layer and target layer as the same layer.
  • set id field as input and output unique fields.
  • Output Matrix Type -> select Linear Matrix. Enable the checkbox 'use only nearest(k) points' and set its value to 1.
  • now ideally it should create a CSV file with four records because we chose a single neighbour only.
  • But the resulting CSV is blank
  • Now try increasing the nearest(k) value to 2.
  • now for each feature in the shapefile, there should be two rows in the csv. so there should be 8 rows. But you can see that there are only four rows.

I have submitted a pull request that addresses this issue here.
https://github.com/qgis/Quantum-GIS/pull/538

#11 Updated by vinayan Parameswaran over 4 years ago

  • Status changed from Closed to Reopened
  • Resolution deleted (worksforme)
  • Pull Request or Patch supplied changed from No to Yes

#12 Updated by Giovanni Manghi over 4 years ago

  • Status changed from Reopened to Feedback

I have submitted a pull request that addresses this issue here.
https://github.com/qgis/Quantum-GIS/pull/538

can the ptach be submitted to allow tests? cheers!

#13 Updated by Giovanni Manghi about 4 years ago

  • Pull Request or Patch supplied changed from Yes to No
  • Status changed from Feedback to Open
  • Estimated time deleted (0.50)

https://github.com/qgis/Quantum-GIS/pull/538

The request has been closed but not committed and I see that the bug is still there.

#14 Updated by vinayan Parameswaran about 4 years ago

below pull request should fix it..
https://github.com/qgis/Quantum-GIS/pull/769

#15 Updated by Borys Jurgiel about 4 years ago

  • Status changed from Open to Closed

#16 Updated by Giovanni Manghi 5 months 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