2

I am using QGIS 3.4.1-Madeira.

I have a base layer map that represents areas as polygons. I have created a CSV file with many entries of different NGO projects, and each one is coded with the ID of the spatial area it takes place. I understand I can't do a simple Join because it only joins one row of the CSV to each area polygon. I have set up a Relation in the Project Properties, which reflects the data structure I want, but I can't figure out how to make it just display in the map as a new layer.

  • As far as I can see, shapefiles can store only 1:1 relations and a clean way to realize a one to many relation is using some database format, e.g. spatialite and store both tables. Unfortunately a related table, like in the ESRI-world, has no equivalent in a database. – Andreas Müller Dec 4 '18 at 9:49
  • you should read about virtual layers concept of QGIS, it offers a lot of possibilities known from databases like joining data and building new layers based on that join. Just as a starting point (the concept is the same in QGIS 2.18 and 3.4): docs.qgis.org/2.14/en/docs/user_manual/working_with_vector/… – eurojam Dec 4 '18 at 17:29
1

Let me suggest Join attributes by field value tool (though I am conscious this is not a direct answer to your question: how to utilize your established Relation).

This tool joins two tables using key field from each table. Its Create separate feature for each matching feature (one-to-many) option allows us to create one-to-many relational table, extending (duplicating) one record to match with many other records in the other table.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.