I am quite new in QGIS and I really need your help.

I have a map of Kenya divided into 68 districts and I have coordinates of 30.000 schools. The points have one variable besides the latitude and longitude data called "distance to nearest school".

First I imported the map. Then I imported the spreedsheet and transformed it to a SHP file like the map. So now I have two SHP files.

The points have three variables: "Latitude", "Longitude" and "Distance to nearest school". I want to have a fourth variable called "District" and take the mean of the "Distance to nearest school" for each district.

  • Welcome to gis.SE. Are the two shapefiles in the same Coordinate Reference System? Have you tried importing the two shapefiles into QGIS? Do they "look right"?
    – BradHards
    Commented Mar 6, 2014 at 9:42
  • Yes, they "look right". I mean, the points are located over the correct geographic areas on the map of Kenya. Commented Mar 6, 2014 at 9:43
  • So break it down into two stages - first find out which district, then do the averaging. There is a tutorial at qgis.spatialthoughts.com/2012/02/… that shows the sort of operation you need for the first part.
    – BradHards
    Commented Mar 6, 2014 at 9:47
  • I have tried the link you sent. The thing is, it only counts the number of points within each district. My problem is for each point to create a new column which identifies the district. I hope it makes sense. :) Commented Mar 6, 2014 at 9:54

1 Answer 1


you can do a spatial join between your points and your districts: vector > data management tool > join attribute by location. There is a detailed tutorial on this page

  • Thank you so much. Works like a charm. Also thanks to you BradHards :) Commented Mar 6, 2014 at 10:26

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.