Feature request #1638

copy/paste of attributes/layers (merge) gives unexpected results(?)

Added by Giovanni Manghi over 15 years ago. Updated over 15 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:Vectors
Pull Request or Patch supplied: Resolution:wontfix
Easy fix?:No Copied to github as #:11698

Description

A common definition of "Merge" of layers is the following:

"Merge
This geoprocess can work with many input layers. It merges all of these creating a new result layer which has a feature for each feature of all input layers. Because each input layer could have its own alphanumeric schema, user must select which layer will preserve its schema. The rest of input layers will only preserve those attributes whose name and type would be the same that an attribute of the input layer whose schema will be preserved."

Actually seems to me that the only way to merge two or more layers in QGIS is to copy/paste (all the) features to an existing layer or to a new empty one.

If we stand with the above definition the operation gives an unexpected, wrong, table of attributes.

Example:

layer A
column name "codigo" type "integer" value "100"

column name "apelido" type "string" value "evora"

layer B
column name "codigo" type "integer" value "200"

column name "apelido" type "string" value "montemor"

layer C
column name "codice" type "integer" value "300"

column name "cognome" type "string" value "parma"

layer D
column name "codigo" type "string" value "lisboa"

column name "apelido" type "integer" value "400"

if I copy/paste B to A the result is

codigo nome

100 evora

200 montemor

and it is right

if I copy/paste C to A the result is

codigo nome

100 evora

300 parma

and it is wrong

if I copy/paste D to A the result is

codigo nome

100 evora

0 400

and it is wrong (in this last case it cannot copy the string value into an integer column but it makes to copy the integer value into a string column)

tested on debian, ubuntu and windows xp

History

#1 Updated by Gary Sherman over 15 years ago

Change component from Build/Install to something more appropriate

#2 Updated by Jürgen Fischer over 15 years ago

Replying to lutra:

A common definition of "Merge" of layers is the following:

[...]

Actually seems to me that the only way to merge two or more layers in QGIS is to copy/paste (all the) features to an existing layer or to a new empty one.

I wouldn't expect that to generally work. IMHO pasting features to a layer should NOT add any new attributes (ie. columns).

Although I didn't check what currently happens, I'd expect that the attributes of the features to paste are just sequentially mapped to the attributes of the destination layer.

If the datatypes of the original differ from the destination attributes that mapping might not work correctly and lead to problems when trying to commit the changes later.

So I'd expect pasting to work only if source and destination layer are structually identical.

You might find something like that in fTools - Union maybe.

#3 Updated by Giovanni Manghi over 15 years ago

Hi,
sorry but I do not agree with your point of view.

The above definition of "merge" is pretty common in books, manuals and is indeed one of the first "geoprocessing" operations that is explained in courses for beginners. Other softwares do behave according the above definition.

I get the attention of Carson and he probably will add this tool in the near future, but unless implemented it will permit just to merge entire layers, not just a few features. I would expect to do that with a copy/past operation.

#4 Updated by Jürgen Fischer over 15 years ago

Replying to [comment:4 lutra]:

sorry but I do not agree with your point of view.

The above definition of "merge" is pretty common in books, manuals and is indeed one of the first "geoprocessing" operations that is explained in courses for beginners. Other softwares do behave according the above definition.

I just said that IMHO cut&paste and "merge" are different things.

#5 Updated by Giovanni Manghi over 15 years ago

Sorry,
I get it wrong.

But the problem stands.

We probably have a tool to merge entire layers (two or more) but this way we will still miss something to merge just a few features.

#6 Updated by Giovanni Manghi over 15 years ago

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

I'll close this ticket because:

a) ok, we know now that copy/paste of features among layers does not work as the requested merge tool.

b) I'll send, if necessary (I'll give a llok now), two patches for the documentation to explain how copy/paste of features among layers works and how works the "merge features" tool.

c) I'll open a ticket to request a "real" merge tool.

PS
The suggested use of "Union" does not fit the request of the merge tool because:

1) Union is an overlay operation --> works only with polygons, Merge works with all geometries

2) By definition "Union" is different from the "Merge" operation

Also available in: Atom PDF