1

I have a file with 3D building information (GML file with building id and coordinates). Also, I have a CSV file with the same building IDs, coordinates (X-Y and Longitude Latitude), and additional values, e.g. the year of construction.

Now I would like to visualize the GML file (2D), e.g. the years of construction in colors (1900 red to 2010 green). I have both files loaded in a project, but I can't get them linked and visualized. How do I get this to work?

I am new to QGIS and using QGIS 3.16 LTS.

1
  • Take a look at the processing tool 'Join attributes by field value'. The building ID colum will be your key on which to join the tables.
    – Matt
    Sep 13, 2021 at 14:46

2 Answers 2

3

You can also do a direct join without creating a new layer. One option is to use virtual layers, but in this answer I recommend to just use a dynamic layer join:

  1. Right click your layer and choose "layer properties"
  2. Go to "Joins"
  3. Click the "small green plus symbol"
  4. Setup your Join-Layer and Join-Fields (buildingIDs in your case)

enter image description here

You will now have the matching attributes from your second layer in your first layer.

To then visualize your result go to Symbology, choose a graduated renderer and your linked year field as column. Choose a nice color bar and click classify. Done.

enter image description here

2
  • Thanks. Under 'Symbology' I cannot select any data of the CSV file. If I create something under 'Joins' and press ok and then open the same window again, the join is gone. Should it be like this?
    – Hur'q
    Sep 16, 2021 at 7:33
  • You may need to first import the CSV as a layer (the first 2 screenshots of my answer)
    – Matt
    Sep 16, 2021 at 10:24
1

Make sure to import your CSV as a Delimited Text Layer. Choose No geometry (attribute only table).

enter image description here

enter image description here

Then use the Processing tool Join attributes by field value.

enter image description here

enter image description here

Define the field on which to join (in this example: id). If you want to join specific fields, select them using the Layer 2 fields to copy option.

enter image description here

The result will be a new vector layer with the CSV attributes attached

enter image description here

2
  • Thanks. But where did I find 'Processing tool Join attributes by field value'?
    – Hur'q
    Sep 16, 2021 at 7:27
  • I have updated my answer with how to find it
    – Matt
    Sep 16, 2021 at 10:23

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.