Thursday 25 January 2018

filter - Filtering a layer with attribute value from another layer in Qgis 2.18


I am pretty new to Qgis and a real beginner when it comes to working with expressions in Qgis. Maybe someone can help me with following problem:


Example


I have several Layers (like Building + House) and each of them have specific attributes values that i want to filter. So my idea was to get an extra layer Test with the attribute value that i want to filter on the other layers and put a filter expression to the attribute value A in table category_1 of layer Test. Basically to avoid rewriting the filters for each layer all the time. But I dont know how to get it done. I tried it with get_feature and attribute() but in my Qgis 2.18 there is no help how such expressions have to look like. That makes it really hard if u have no clue. So how can I filter with the attribute value A in category_1 of layer the Test in the layer House ?




Answer



If this is about Select features using an Expression enter image description here function, please try examples below:


House


"category_2" = attribute(get_feature('Test', 'ID', '1'), 'category_1')

Building


"category_3" = attribute(get_feature('Test', 'ID', '1'), 'category_1')

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...