I'm measuring different values of urban parks (groundwater recharge, CO2 sequestration etc.), assignning values to the park polygons as attributes of a layer. Now I would like tu sum them up to have an overall score per neighbourhood in another layer, something similar to the picture I attach. I guess it should be something simple but I still can't find the way to do it.

I'm working with QGIS 2.18.

initial map and desired output example


Run the Statistics by Categories tool on the "Capacity" layer. To run this tool, the "Capacity" layer must have a 'neighborhood' field. Use the 'neighborhood' field for the "field with categories."

The output will be a table with statistics for each neighborhood. Join this table to your neighborhood layer.

Update: I found another method. Perform a spatial join (Vector menu > data management tools > Join attributes by location) with "neighborhoods" as the target layer and "capacity" as the join vector layer. Choose the option to "Take summary of intersecting features" and check the box for "Sum." The output will be a polygon layer of neighborhoods with an attribute that's sum of all intersecting capacity polygons.

  • So first I should add a new field "neighbourhood" and specify the one correspondent to each of my green areas polygons? What about the green areas that are included in two or three neighbourhoods? – María RG Aug 7 '18 at 10:01
  • If the capacity polygons overlap multiple neighborhoods, you have to decide how to hand that before proceeding. One method would be to split them along neighborhood boundaries, assume that the 'capacity' stat is evenly distributed throughout the polygon, and divide it proportionally to the area on either side of the split. That's really a separate question though. You should search GIS Stackexchange to see it it's already been asked and answered. – csk Aug 7 '18 at 18:09
  • I tried to do a spatial join between both layers (intersect, take summary or intersecting layers) and the result was that, in the target layer attribute table (the one with the neighborhoods) it mixed all the Id, ward names, and areas, and it didn't incude a new attribute column with the values from the join vector layer. This target layer was a copy of my original neighbourhood layer, but now both of them show this wrong data. I don't even know how to get the original values in my layer. – María RG Aug 7 '18 at 21:24

Do you have a shapefile with the borders of the area like in the image on the right side? If so, you might clip the left image with the polygon of the right image to acquire the smaller areas. If the data on the left is a raster file, you can create raster statistics which also outputs a sum. If it's vector data, you can just clip them and sum them up in the attribute table I guess?

  • Yes, I have a shapefile with the bondaries of the neighbourhoods. The data on the left is not raster but vector, in my case (polygons). If I clip them, how should I sum them? picking one by one the portions included in each neighbourhood? there is not a more automatic way to do it? – María RG Aug 6 '18 at 10:26

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.