In QGIS 3.14 I am using three polygon layers; one representing buildings, the second representing "city ​​boundaries" and the third representing the municipal boundary.

My aim is to show all the buildings which are placed inside the municipal boundary but outside of the "city boundaries", i.e. buildings in "the open land". I am not interested in making any new data, I only want to visually hide/show features.

My idea was to use the geometry generator, but I don't know if there is any other way to do it?

I first tried to just show all the buildings indside the municipal boundary by typing the following code in the geometry generator:

intersection( $geometry,
geometry( get_feature( 'name-of-municipal-boundary-layer','gid','1')))

and that did work out fine.

Starting point: Starting point:

After using the geometry generator: After using the geometry generator

My problem is that I don't know what to do from here.

I also tried to show all the buildings inside one of the "city ​​boundaries" the same way as with the municipal boundary to just see if that was even possible, but that didn't work..

intersection( $geometry,
geometry( get_feature('name-of-city-boundary-layer','gid','1'))

It just gave me an empty layer looking like this: showing buildings inside city boundary


1 Answer 1


You dont need to use the geometry generator (unless you want to). Place the layers in this order and apply filters:

  1. Munic with filter to show all features but the one you are interested in
  2. City with filter to only show the one you want
  3. Buildings underneath

enter image description here

  • 3
    Simple solutions are the best solutions.
    – Erik
    Nov 17, 2020 at 13:21
  • I my case the city layer has to be transparent or only the boundary so it is possible to show roads and other stuff inside them - exept the buildings! So if I just put the building layer underneath the city layer, all the buildning will be showing - or i'm I missing something?
    – jkh5
    Nov 17, 2020 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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