3

I have a point shapefile that corresponds to locations of animals captured. I've joined a table to this shapefile with additional information on each attribute, namely nb. animals caught in each point. I have another shapefile (hexagonal grid) and my goal is to sum the nb. animals caught for each point that falls inside each hexagon. In a preliminary search on the web, I found that maybe "join by location" could help me do this, but the problem is that I'm getting an "incorrect field name" error, for a field that doesn't even exist in any of the original tables and, on the other hand, it won't let me select the specific field I want it to sum..

Any suggestions? Is there any way I can do this without going into writing scripts mode?

  • 1
    I was wondering if you had a chance to try the solution I posted below and if it was helpful to you at all – dassouki Jul 16 '13 at 11:47
3

There is another tool that does a good job for such purposes: In QGIS processing toolbox with SAGA data provider activated you may search for a tool called 'point statistics for polygons'. Herein you can provide your hexagons (polygons) and your animal observations as points, select an attribute to analyze and the statistical metrics you want.

I prefer this tool because QGIS 'join attributes by location' produces weird results under special circumstances, cp. QGIS 'join attributes by location' algorithm produces strange results for min, max

(screenshot will be added)

2

For the following procedure, let's assume your polygon layer is called Po_lyr and your point layer is called pt_lyr.

Method 1:

  • Load the Po_lyr and pt_lyr into QGIS
  • CLick on Vector -> Analysis tools -> Points in Polygon
  • Load the po_lyr on top and the pt_lyr in the point layer selection menu
  • Specify where you want the file to be saved
  • Add the new layer to the map
  • Right click on the map's name and chose Open Attributes
  • The results should be there

Method 2:

  • Load the Po_lyr and pt_lyr into QGIS
  • CLick on Vector -> Geoprocessing Tools -> Intersect
  • In the window that appears, the input layer is pt_lyr and the intersect layer is po_lyr
  • Save the output shape file as result_pt_in_poly.shp
  • Load that layer to to QGIS
  • Right click on the layer again and click on Attribute Table
  • At this point you can output the table to a spreadsheet and do the math there since for every point, you'll have the ID of the polygon in every point layer.
  • If you want to still continue using QGIS, then I assume you'll have to use python console for that but someone here can correct me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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