I am a new user of QGIS (version 3.2.3) and I find myself in need to do some calculations. I am trying to find the average distance between two sets of points (i.e. schools and settlements) contained in two different layers within given districts, which comes in polygons.

My ultimate goal is to calculate the average distance traveled to school for each district. I tried to calculate the distance matrix but it didn't yield the results I wanted.

How can I complete this task?

  • 2
    By calculating those distances between two sets of points do you mean simply straight lines or some more complex routes based on paths taken from a different line layer?
    – Taras
    Commented Apr 21, 2020 at 5:11

1 Answer 1


You could try out processing algorithm Distance to nearest hub (line to hub) and use schools as hubs and settlements as source. This creates you a straight line to the nearest schools and has distance as an attribute. Then from these lines in the resulting layer, you can use Basic statistics for fields to calculate the average distance.


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.