I have one table that contains 450 locations and a table that has 10'000 rows containing data and no spatial information. I have a column that allows me to join them. The issue is that I want to have the joinig to take place by having my data table as main table. Therefore the solution of using the data table and converting it to a shape data and joining it with my data layer is not an option since it creates a file with only 450 rows and which obviously was not the intended result. What would be the solution to this problem.
-
Are they both shapefiles or just the one containing the 450 locations?– JosephCommented Jul 15, 2014 at 11:09
-
They are both actually .csv files. And the location file has it's coordinates in the famous x, y format in seperate columns.– NyquistCommented Jul 15, 2014 at 11:12
-
1What you're trying to do is called a one-to-many join. Both QGIS and ArcGIS have challenges when trying to do this. It sounds like QGIS did the same thing Arc would - returned first matching record and that's it. The question I've flagged this as a duplicate of should help you on the QGIS side. Note there are different ways to handle this - either as a relate or with duplicate geometry. You could join the other way in a regular database and then create points from the xy for duplicate geometry - it's not clear what your end goal is (ie, how many points).– Chris WCommented Jul 15, 2014 at 19:38
-
My final objective was to obtain 10'000 rows containing respective locations after the merge. In theory the linking feature works. It is just that when for example generating text diagrams I cannot chose the attributes of the huge data table as a option for visualization.– NyquistCommented Jul 16, 2014 at 8:20
-
Ok has worked as intended thank you Chris W and Joseph. It was indeed what I wanted to do. The joining feature however is very slow. I might suggest the usage of excel Vlookup or access query to do it and then feed the table to QGIS rather than to do it in the application directly.– NyquistCommented Jul 16, 2014 at 9:20
|
Show 1 more comment
1 Answer
If I understand your question correctly, you could try the following:
- Add the .csv file with the 450 locations layer as a Delimited Text Layer and select the appropriate options
- Add the other .csv file again as a Delimited Text Layer but select the No geometry (attribute only table) option
From the Processing plugin, select the Join attributes table algorithm, add both layers as the Input layers and select the same Column that both layers have as the Table field.
NB: I haven't tested this method on .csv files but it may still work.
-
It seems like it might be the sollution but QGIS is sadly stops to respond when I try to do this.– NyquistCommented Jul 15, 2014 at 14:27