Opened 15 years ago
Closed 15 years ago
#1638 closed enhancement (wontfix)
copy/paste of attributes/layers (merge) gives unexpected results(?)
Reported by: | lutra | Owned by: | |
---|---|---|---|
Priority: | minor: annoyance | Milestone: | Version 1.2.0 |
Component: | Vectors | Version: | Trunk |
Keywords: | merge | Cc: | pcav, jef |
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
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
Change History (7)
comment:1 by , 15 years ago
Component: | Build/Install → Vectors |
---|
comment:2 by , 15 years ago
Owner: | changed from | to
---|
comment:3 by , 15 years ago
Milestone: | Version 1.0.2 → Version 1.1.0 |
---|---|
Must Fix for Release: | Yes → No |
Owner: | removed |
Platform: | Debian → All |
Priority: | major: does not work as expected → minor: annoyance or enhancement |
Type: | bug → enhancement |
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.
follow-up: 5 comment:4 by , 15 years ago
Cc: | added |
---|---|
Keywords: | merge added |
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.
comment:5 by , 15 years ago
Replying to 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.
comment:6 by , 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.
comment:7 by , 15 years ago
Cc: | added; removed |
---|---|
Resolution: | → wontfix |
Status: | new → 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
Change component from Build/Install to something more appropriate