2

I have two layers

  1. "Suburb_Type", that has more than 1000 suburbs in shapes and is styled with categorisation rule. (columns: 'suburb_code', 'geometry', 'category_variable')
  2. "Suburbs_in_Study", with identical geometry data to Suburb_Type but without the column 'category_variable'.

I want to apply a rule-based style on "Suburb in Study", so that it will highlight (draw thick outlines) those that are listed in another layer, "Study_List" (CSV, no geometry) using 'suburb_code'. (columns: 'suburb_code'; only a handful of suburbs are listed).

How do I apply a rule-based style using expression editor? I've seen tips that utilise geometry intersection. However, since my list does not have geometry but is a simple CSV list, I'm unsure how I'd go about it. The idea is that Study_List.csv will be updated frequently.

  • 3
    You can use Join Attributes by Field Values to join the CSV file with the suburb layer using the suburb_code. Here is an example on how to do it: Performing Table Joins (QGIS3) – ahmadhanb Apr 24 at 7:30
0

If the data in your CSV will change frequently, the best way is to use an expression in the symbology of the geometry layer to show it with different stroke widths based in the relation between geometry and CSV.

You can use this expression:

if(
 (relation_aggregate( 
 relation:='relation',
 aggregate:='count',
expression:="field")), 1, 0.2)

in the Stroke width Data defined override

enter image description here

To use this expression you must create before a new Relation in the Project Proprieties (in this example called relation).

In the expression change the field with yours (suburb_code according to your info). The two numbers at the end of the expression are the thickness of the outline if the condition (the expression) is true or false.

This is the result

enter image description here

| improve this answer | |

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.