I have a shapefile (.shp file) which defines a large number (several thousand) separate areas.

I also have an Excel spreadsheet which contains a large number of data points. Each data point consists of a latitude and longitude, and a "weight".

I want to determine, for each area in the shape file, the total weight of all the data points whose lat/long is in that area. I would prefer to have this information in a format that can be downloaded back into the Excel spreadsheet.

What is the best way to do this in QGIS?

  • 2
    Can't you use the "Points in Polygon"-Tool and save the resulting Polygon layer afterwards to csv?
    – Julian
    Commented May 12, 2014 at 7:44
  • Correct me if I'm wrong, but that counts the number of objects and doesn't allow for them to be weighted? Commented May 12, 2014 at 10:10
  • Sry haven't seen this point.
    – Julian
    Commented May 12, 2014 at 12:55

1 Answer 1


What I would do, is load the points into QGis (by adding a text delimited layer), and save that as a shapefile. Load the shapefile into QGis, toggle editing. Then in the Vector menu, under Datamanagement Tools, use the plugin 'Join attributes based on location'. Doing so, add the name of the area as an attribute to the shapefile. Rightclick the shapefile, and save it back to a .csv file.

Now if you load the CSV back into Excel, you'll have an additional column listing which area they are in. If you have a list of all possible area's in Excel, you can use the =SUM.IF() function to find the total weights of the datapoints for each of them.

  • 1
    Alow me an improvement to your answer. After the join attributes based on location operation, you don't need to go back to the spreadsheet. Just use the Group Stat Plugin to sum the weigth fields by area's name. Commented May 12, 2014 at 10:48

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.