Feature request #3010

ftools (merge shapefiles tool): patch to add option to select attribute table structure

Added by Rui Pedro Henriques about 14 years ago. Updated over 7 years ago.

Status:Closed
Priority:Low
Assignee:cfarmer -
Category:Processing/QGIS
Pull Request or Patch supplied: Resolution:fixed
Easy fix?: Copied to github as #:13070

Description

The attached patch allows the user to choose one of the input payers as the source for the new attribute table.

Also, sets the attributes of the new layer based on the field name rather then the order in which it appears. When the field is not found in the current layer, it tries to set the value "-9999".

doMergeShapes.py Magnifier (8.38 KB) Rui Pedro Henriques, 2010-09-15 08:05 AM

ui_frmMergeShapes.py Magnifier (4.63 KB) Rui Pedro Henriques, 2010-09-15 08:05 AM

Associated revisions

Revision 6327b2e2
Added by Alexander Bruy over 13 years ago

allow merging shapefiles with different attribute tables (fix #3010)

History

#1 Updated by Rui Pedro Henriques about 14 years ago

changes in files are marked [rph] and contain the indication on how many lines were changed.

#2 Updated by cfarmer - about 14 years ago

  • Status changed from Open to In Progress

Please attach the .ui file with the above changes rather than the generated ui_.py file.
Also, am unsure whether using a default of -9999 is a good idea, given that some users might be using this value for some other purpose. May be better to leave fields blank?

Carson

#3 Updated by Alexander Bruy about 14 years ago

May be it is better to gather all attributes from input shapes into output shape, as in MMQGIS?

#4 Updated by Giovanni Manghi about 14 years ago

I'm not the author of the patch, so maybe is better to wait for his feedback. In any case your suggestion makes sense.

By the way... any feedback by the author of mmqgis? is he going to contribute his tools in the qgis repos?

#5 Updated by Alexander Bruy about 14 years ago

Replying to [comment:5 lutra]:

I'm not the author of the patch, so maybe is better to wait for his feedback. In any case your suggestion makes sense.

I see :-). So I'll start to modify Merge tool to gather all fields from input files.

By the way... any feedback by the author of mmqgis? is he going to contribute his tools in the qgis repos?

Unfortunatelly I have no info about this. I think we should ask Carson

#6 Updated by Rui Pedro Henriques about 14 years ago

Replying to [comment:4 alexbruy]:

May be it is better to gather all attributes from input shapes into output shape, as in MMQGIS?

Hi! I don't know how MMQGIS works, but what would be the behaviour exactly? If there is field X in shapefile A and field X in shapefile B, what would be the output? All values go to the new field X in output file or will there be two fields: A_X and B_X? I've seen both behaviours before and although the first one might work, the second one tends to be bad and to fail in large groups of layers with the same field names.

The option to choose the shapefile that will be the model for the new attribute table had a "trick" behind it: if I wanted to add or remove fields it's easy to create a new empty shapefile with the desired fields and, therefore, choosing it will cause unwanted fields to be dropped and wanted fields to be created, eliminating the need to further edition on the output shapefile.

As I see it, the best option - maybe not for now - would be to show the user a list of all the fields and to let the user choose which ones should appear in the output.

I'm still struggling with QT and python trying to create the *.ui file that Carson asked for...

#7 Updated by Alexander Bruy over 13 years ago

  • Status changed from In Progress to Closed
  • Resolution set to fixed

Starting from 6327b2e22416c52142bb Merge shapefiles tool collect all attributes from input files and store them in output file.

#8 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