Opened 9 years ago

Closed 9 years ago

#3010 closed patch (fixed)

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

Reported by: rph Owned by: cfarmer
Priority: minor: annoyance Milestone: Version 1.7.0
Component: fTools Version: Trunk
Keywords: ftools, merge Cc:
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no

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".

Attachments (2)

doMergeShapes.py (8.4 KB) - added by rph 9 years ago.
ui_frmMergeShapes.py (4.6 KB) - added by rph 9 years ago.

Download all attachments as: .zip

Change History (12)

Changed 9 years ago by rph

Attachment: doMergeShapes.py added

Changed 9 years ago by rph

Attachment: ui_frmMergeShapes.py added

comment:1 in reply to:  description Changed 9 years ago by rph

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

comment:2 Changed 9 years ago by lutra

Must Fix for Release: NoYes
Summary: ftools: added option to select attribute table structureftools (merge shapefiles tool): patch to add option to select attribute table structure

comment:3 Changed 9 years ago by cfarmer

Status: newassigned

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

comment:4 Changed 9 years ago by alexbruy

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

comment:5 Changed 9 years ago by 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.

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

comment:6 in reply to:  5 Changed 9 years ago by alexbruy

Replying to 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

comment:7 in reply to:  4 Changed 9 years ago by rph

Replying to 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...

comment:8 Changed 9 years ago by borysiasty

Component: Python plugins and bindingsfTools

comment:9 Changed 9 years ago by alexbruy

Must Fix for Release: YesNo

comment:10 Changed 9 years ago by alexbruy

Resolution: fixed
Status: assignedclosed

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

Note: See TracTickets for help on using tickets.