Bug report #4761

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

Added by Borys Jurgiel over 2 years ago. Updated about 1 year ago.

Status:Closed Start Date:01/07/2012
Priority:High Due date:
Assigned to:- % Done:

0%

Category:fTools
Target version:Version 2.0.0
Platform: Patch supplied:No
Platform version: Affected version:master
Status info: Causes crash or corruption:No
Resolution: Tag:

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 580b947498c615ab6e740e539ccfa50067baa6c2
Added by Borys Jurgiel about 1 year ago

Merge pull request #769 from vinayan/topol

Fix #5181,#4761 - Ftools-Distance Matrix

History

Updated by Borys Jurgiel over 2 years ago

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

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

Updated by Borys Jurgiel over 2 years ago

  • Causes crash or corruption changed from No to Yes

Updated by Borys Jurgiel over 2 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.

Updated by Giovanni Manghi over 2 years ago

  • Priority changed from 6 to High

Updated by Paolo Cavallini over 2 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0

Updated by Giovanni Manghi over 2 years ago

  • Assigned to deleted (cfarmer -)

Updated by Salvatore Larosa over 2 years ago

  • Status changed from Open to Feedback
  • Causes crash or corruption changed from Yes to No

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

Can you share your testcase?

Updated by Paolo Cavallini almost 2 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

Updated by Giovanni Manghi almost 2 years ago

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

Closing for lack of feedback. Please reopen if necessary.

Updated by vinayan Parameswaran over 1 year 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

Updated by vinayan Parameswaran over 1 year ago

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

Updated by Giovanni Manghi over 1 year 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!

Updated by Giovanni Manghi about 1 year ago

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

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.

Updated by vinayan Parameswaran about 1 year ago

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

Updated by Borys Jurgiel about 1 year ago

  • Status changed from Open to Closed

Also available in: Atom PDF