Geographic Information Systems Asked on March 13, 2021
I have an excel with 4 columns (Region; District; village; number of cases)
Have a shapefile with dots for villages with many columns including (Region ; District ;Village)
I want to plot the cases of the excel (as dots on the villages) by joining the excel file and the shapefile.
The problem is that there are many villages (1000 in total) and many of them have the same name, but belong to different districts. The names of the districts are unique.
Therefore, I would need to join by 2 fields, (not only by village, but , by village and by district). I would need to join excel and shapefile by the fields “District” and ” village” so the new column “cases” in created in the shapefile attributes table. I wonder HOW IS THAT DONE?? In QGIS I have learnt to join by 1 field (village), but if I add a second join (district) I lose many of my cases.
Is there a way QGIS can do that? Do I need to make some conditional or something?
The key here is to make two fields into one. Like lot and plan becomes lotplan (eg. Lot 10 on SP1234 -> 10/SP1234) in BOTH tables.. then join as normal. This is easy in Excel by adding a new header cell and use the function =A1 & "" & B1 (or whatever you cells are) and then use field calc in QGIS. – Michael Miles-Stimson
Correct answer by Elsa on March 13, 2021
So... this is how I have done it. For large number of entries, it works. I created drop-down menus in excel , then concatenate in excel: concatenate(a1;b1) then concatenate same fields in the shapefile using FIELD CALCULATOR : concat(field1,field2)
Then Join both and that.s it.
For few registries, I think you can enter data manually on a new column (shapefile). Many thanks for the idea, Elsa
Answered by Elsa on March 13, 2021
Another way would be to add a new field with a unique identifier for each village, irrespective of name. EG "1" might be London (England) and "2" might be London (Canada).
Answered by Isaac on March 13, 2021
Assuming you only want to use QGIS you could create a virtual field for both layers and use it for the join.
Simply select the table -> Open Field Calculator -> Create a new virtual field of unlimited text.
You can combine the fields you want to use into this "join_field" with a simple:
"District"+'_'+"village"
Performing this twice obviously since you'd need that field in your point layer as well.
Using an underscore as a separator for districts and villages that have hyphens or spaces in their names should work for you.
Answered by Dror Bogin on March 13, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP