4

I'm a little new to this, is there a way to have features on a layer render only if they overlap with features on another layer?

I have roads of a city, and different areas in the city, and I'd like to only render roads that are entirely within the bounds of the city. I guess that means using a rule-based render on the features in the road layer, I just don't know the syntax of the condition "Overlaps with city layer."

5

Yes, this is possible. You need to have the refFunctions plugin installed and enabled by going to the menubar:

Plugins > Manage and Install Plugins...

Select the Rule-based style of your desired layer and use an expression like the following (note that single quotation marks for the field name):

geomoverlaps( 'other_layer_name', 'any_field_name' )

Example:

  1. Two example layers, "Layer_2" has a couple of polygons which overlaps the two polygons in "Layer_1":

    Layers

  2. Now we set the rules for "Layer_2" using the expression above:

    Rule-based style

  3. Result!

    Results

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.