Bug report #21501

Distance matrix does not maintain data type and precision for Input Point Layer in Linear (N*k x 3)

Added by Andy Whyte about 5 years ago. Updated almost 5 years ago.

Status:Open
Priority:Normal
Assignee:Victor Olaya
Category:Processing/QGIS
Affected QGIS version:3.7(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29318

Description

I have noticed that the distance matrix does not maintain precision or data type in InputID field created from the ID of the Input Point Layer to the tool.

This is an issue because it means I cannot join my result to an existing layer. The Target Point layer does not seem to do this.

For example the attached shapefile has an ID column (double, REAL, 20, P=0). When run through the distance matrix it inserts a decimal place. Additionally even if I use an integer ID field the output table will still not join to itself so it must be changing the type somehow to stop it from joining.

I am using QGIS 3.6

Point layer.cpg (5 Bytes) Andy Whyte, 2019-03-06 04:18 PM

Point layer.dbf (1.36 KB) Andy Whyte, 2019-03-06 04:18 PM

Point layer.qpj (690 Bytes) Andy Whyte, 2019-03-06 04:18 PM

Point layer.prj (417 Bytes) Andy Whyte, 2019-03-06 04:18 PM

Point layer.shp (1.82 KB) Andy Whyte, 2019-03-06 04:18 PM

Point layer.shx (604 Bytes) Andy Whyte, 2019-03-06 04:18 PM

Clipboard01.png (35.6 KB) Victor Olaya, 2019-05-23 01:20 PM

Test.PNG (29.5 KB) Andy Whyte, 2019-05-23 03:29 PM

History

#1 Updated by Giovanni Manghi about 5 years ago

  • Category changed from Unknown to Processing/QGIS

#2 Updated by Victor Olaya almost 5 years ago

  • Assignee set to Victor Olaya

#3 Updated by Victor Olaya almost 5 years ago

I am not able to reproduce it. Loooking at the code, the algorithm copies the input field definition literally, and doenst alter it.

As you can see in the attached screenshot, the fields in the output table have precision 0

#4 Updated by Andy Whyte almost 5 years ago

Victor Olaya wrote:

I am not able to reproduce it. Loooking at the code, the algorithm copies the input field definition literally, and doenst alter it.

As you can see in the attached screenshot, the fields in the output table have precision 0

Now try and join your "InputID" field from your distance matrix back to your Point layer "REFKEY" field

#5 Updated by Andy Whyte almost 5 years ago

The input ID is assigned a decimal point - please see PNG image.

#6 Updated by Giovanni Manghi almost 5 years ago

  • Operating System deleted (Windows 10)
  • Priority changed from High to Normal
  • Affected QGIS version changed from 3.6.0 to 3.7(master)

Also available in: Atom PDF