Bug report #6063

ftools "Convex hull(s)": wrong attributes in output

Added by Bernd Vogelgesang over 12 years ago. Updated over 7 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Processing/QGIS
Affected QGIS version:master Regression?:
Operating System: Easy fix?:
Pull Request or Patch supplied:Yes Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:15424

Description

When creating convex hulls from a point layer (.shp) based on a common attribute ("create convex hulls based on input field"), one would expect that the resulting polygon layer would at least contain this attribute in the table.
But in opposite to this, the resulting table structure is just a complete copy of the points attributes table and most of its fields are empty (of course, cause most point values differ).
Two fields get populated though, but only with strange numbers which i can't identify.

This behaviour reduces the usability of convex hull enormously, cause i planned to use them as a coverage layer for Atlas and fill the map title with the attribute from the convex hull layer without extra steps ... would all be a real time saver for 300 + x overview maps!

p.s. The closed bug #2529 is similar, but explicitly refers to postgis

pps.: just managed to retrieve my attribute in the table by deleting the first column in my point shape: Now the first column in the polygon layer represents the chosen attribute (3rd column in point layer), field name is of course still wrong.

Clipboard01.jpg - No attribute, but strange numbers (45.6 KB) Bernd Vogelgesang, 2012-07-18 08:11 AM

Clipboard02.jpg - Attributes after removing first column (63.7 KB) Bernd Vogelgesang, 2012-07-18 08:11 AM

polygons.zip (1.91 KB) Daniel Vaz, 2013-08-17 10:27 AM

Associated revisions

Revision 033440fc
Added by Alexander Bruy about 11 years ago

Merge pull request #731 from ddanielvaz/bugfix-6063

Preserve attributes in Convex Hull (fix #6063)

History

#1 Updated by Salvatore Larosa over 12 years ago

Confirmed!

If "create convex hulls based on input field" is checked the tool write the values ​​in the first three fields without changing the name!
Values ​​are the ID, area and perimeter of the polygon!
It should create new fields!

#2 Updated by Paolo Cavallini about 12 years ago

  • Target version set to Version 2.0.0

#3 Updated by Fabian Stenzel over 11 years ago

Still using Version 1.8 of QGIS (standard packages for ubuntu), I can't say if this issue is fixed by now, but I had the same problem, missing/losing the attribute I based my convex hull on.
As Salvatore mentioned, it seems that the newly created convex_hull_shape copies all fields of the old table, but overwrites the first three columns in the creation process with: convexHull_based_field(TYPE),Area(FLOAT),Perimeter(FLOAT) regardless of the types the actual first three fields have. Converting from Float to Integer or String seems to work fine, but if the first field is an Integer (what the ID field usually is) and the convex_hull was based on a String-field the content the convex-hull was based on gets lost.

Work around: use table-manager, create 3 new fields before all the others with the Types: convex_hull_based_field_type,Float,Float.

#4 Updated by Giovanni Manghi over 11 years ago

  • Subject changed from Geoprocessing -> Convex hull(s): Attributes not properly handled to ftools "Convex hull(s)": Attributes not properly handled
  • Priority changed from Normal to High

raising the priority because it produces wrong results.

#5 Updated by Giovanni Manghi over 11 years ago

  • Subject changed from ftools "Convex hull(s)": Attributes not properly handled to ftools "Convex hull(s)": wrong attributes in output

#6 Updated by Daniel Vaz over 11 years ago

What is the supposed behavior of convex hull when create convex hulls based on input field?

Please, give some dataset and correct supposed behavior.

Thank you

#7 Updated by Giovanni Manghi over 11 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Daniel Vaz wrote:

What is the supposed behavior of convex hull when create convex hulls based on input field?

Please, give some dataset and correct supposed behavior.

Thank you

and again... today it seems to work ok... sorry (again) for the noise.

#8 Updated by Daniel Vaz over 11 years ago

  • Status changed from Closed to Reopened

I think that issues was not solved in #8219.

I am working in a bugfix for it.

Please, if anybody has some dataset to test the convex hull tool, I will appreciate.

Thanks in advance

#9 Updated by Daniel Vaz over 11 years ago

Please Giovanni and Bernd Vogelgesang, can you try https://github.com/qgis/Quantum-GIS/pull/731 ?

Thanks

#10 Updated by Giovanni Manghi over 11 years ago

  • Status changed from Reopened to In Progress
  • Resolution deleted (fixed)
  • Pull Request or Patch supplied changed from No to Yes

Daniel Vaz wrote:

Please Giovanni and Bernd Vogelgesang, can you try https://github.com/qgis/Quantum-GIS/pull/731 ?

Thanks

I will ASAP. What exactly does fix your patch? Today it seemed to work ok.

#11 Updated by Daniel Vaz over 11 years ago

It fixes the field populate proccess, reported in description and by Fabian Stenzel.

#12 Updated by Alexander Bruy about 11 years ago

Hmm... for me current implementation works fine

#13 Updated by Bernd Vogelgesang about 11 years ago

made 3 quick tests in 1.9 with common attribute as integer, real and text, and all looks correct.
Thanx a lot.

#14 Updated by Daniel Vaz about 11 years ago

Choose Vector -> Geoprocessing -> Convex Hull -> Create a convex hull based on input field -> Choose any field -> Click Ok

The generated convex hull polygons don't preserve the parent(s) field(s) polygon(s).

The patch fix it.

Thanks in advance

#15 Updated by Alexander Bruy about 11 years ago

  • Status changed from In Progress to Closed

#16 Updated by Alexander Bruy about 11 years ago

  • Resolution set to fixed

#17 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.

Also available in: Atom PDF