1

I'm a newbie to QGIS. I have run into a thing I can not solve despite trying to search for a solution and working through the functions in the tool.

I have two layers I want to compare. One is filled with polygons, the other has polygons spread out. The first one is a map with real estate lots (pardon my English if this is not the right expression, what I mean is areas on the ground which is divided into different legal areas/entities). The second layer is houses.

What I want to have as a end result is a layer with the real estates where there are houses built upon them.

I've been looking for a function where I can compare the two layers and save all polygons from the first layer where there is a polygon in the second layer present. But so far I have only been able to find comparisons which cuts holes, find where there are intersections etc.

2

You need to use the spatial query plugin. It's accessible from the vector menu. If it's not there, you have to enable it in the Plugins => Manage and install plugins.

Under "Select source features from" select your parcels layer and under "Reference features" select your buildings layer. Under "Where features" select "Contains". Click "Apply" and the parcels containing buildings will be selected.

Spatial Query

Be careful that this will only select parcels that completely contain buildings. If a building touches or crosses the parcel boundary, the parcel won't be selected. The image shows one parcel selected where the building is contained in the parcel (in yellow) and the other parcel is not selected because the building edge touches the parcel boundary.

Spatial query result

1

Thanks. That was a neat feature. I tried the different options under "Where the feature" and came out with a good solution.

After trying this I searched some more in the menues and found a very similar way of doing it from the "Select by location" feature. In that dialog I got even more options of how to compare and possible to choose several at the same time. These two will be my go to tools for these operations.

Thanks a lot, I think I just reached level 2 in my QGIS user development journey!

  • Glad to be of help! – Techie_Gus Jul 21 '16 at 7:00

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.