[GIS] Joining attributes of polygons and points by location in QGIS

fields-attributesqgis

I have two shapefiles….

  • points containing a number field 'response_time'
  • a polygon grid of square polygons containing fields including 'PNTCNT' with the number of points per polygon, calculated already using the tool 'points in polygon'

There are between 0 and 600 points within the bounds of each polygon in the grid.

I want to add fields to the polygon grid for the mean, min and max response times within each polygon, in addition to the PNTCNT field already there.

I have tried the 'Join attributes by location' tool, making the polygon layer the target and the points the join layer, and vice versa. I've selected 'take summary of interesting features'.

But I can't get the result I want. All I end up with is the polygon grid again but with an extra field 'COUNT' which replicates (or duplicates) the 'PNTCNT' field. No min, max and mean of values from the points layer.

What am I doing wrong? Is there a better way to do this? I have tried this using QGIS 1.7 and 1.8.

Best Answer

I don't have time to try this out, but in my head it might work...if you have a unique ID for each grid square, and get that ID into a field on each point, then you should be able to get all the statistics you want by using the GroupStats QGIS plugin on the point layer, grouping by the ID. (then save that, join back to the grid and you're in business) Maybe there's something easier still...