Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
    
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 Mar 6 at 9:42
    
Yes, they "look right". I mean, the points are located over the correct geographic areas on the map of Kenya. –  KasperBrandt Mar 6 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 Mar 6 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. :) –  KasperBrandt Mar 6 at 9:54
add comment

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
Thank you so much. Works like a charm. Also thanks to you BradHards :) –  KasperBrandt Mar 6 at 10:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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