I'm using QGIS 2.18.3 (Las Palmas). In order to determine the number of buildings within a district I'm using spatial Query in QGIS. I filter out the specific district within my city-layer so I can apply the spatial query to it. I then go into the attribute Table of my building-layer and input the district for the labelled buildings.

Is there a possibility to automate this process? Does spatial query have a batch-possibility?

2 Answers 2


What you are describing here is a "spatial-join", but you are doing it the hard way (using a spatial-query and doing the input manually).

You can find the proper Tool within Vector --> Data Management Tools --> Join attributes by location. This tool will do the job for every building and district, no selection needed.


You can use virtual field in qgis calculator or Autofield plugin using conditional request(CASE WHEN... THEN...) to choose the features to do spatial query

Your Answer

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

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