This is my first question here. I have used the forum extensively in the past and it has been an incredibly useful resource, but this time I am stuck with an issue I cannot resolve. Here is a brief description. I have a map showing:

  • postal code polygons (in light yellow in the example)
  • another layer shows a few much bigger polygons (let's call them urban areas, in grey in the example) which intersect with the postal code polygons
  • a layer showing points across the map (red stars in the example)

I then create 3km buffer circles around the points from the third layer. Now, here is what i would like to do:

  • when a postal code polygon intersects with a buffer circle AND an urban area polygons, I would like to associate the value 1 with that postal code polygon (if it intersects with two circles AND an urban area than the value would be 1+1=2)
  • finally, I would like to create a heatmap with the postal code polygons based on these values

I'm using QGIS 2.16.3. Please let me know if anything is unclear and I will clarify.

See this extract as example where i added some of the values i would like to see returned, thinking that this would be the best way to build the heatmap in the final step, but if i'm going down the wrong path, let me know.


  • what version of qgis are you using? Commented Nov 4, 2016 at 9:50
  • 1
    And could you add an image of your data Commented Nov 4, 2016 at 9:59
  • i added this information in the original post...
    – Skeboo
    Commented Nov 4, 2016 at 11:49

1 Answer 1


Image really helped cheers.

  1. Identify the postcodes in the urban area. 'Vector > Select by location'. Use this to select all your postcode polygons that intersect the urban area. Save the selected polygons out and I'll refer to this product layer as urban_pc.
  2. Relate buffer zones to postcodes. Use 'Vector > Intersect' to intersect the buffers by urban_pc. The product should be similar to the buffer layer, except now cut up into tiny postcode segments. I'll call this product int_buff.
  3. Time to count. 'Vector > Geometry Tools > Polygon centroids' to extract the centroids from your int_buff layer. These centroids will be a count of the number of buffers that fall within the postcode. Next use 'Processing > Toolbox > (search) Count points in polygon' and with your urban_pc as the polygon layer and centroids as your point layer, the product will be a new urban_pc layer with a new column, counting the points that fall within each postcode. I shall this product count_pc
  4. Finish off. 'Vector > Polygon centroids' on count_pc and you will end with a finished point layer product of postcode centroids that fall within an urban area and how many buffers they intersect.

Now to create the heatmap, either through the style properties, or something more permanent 'Raster > Heatmap > Heatmap' to create a new layer.

  • Brilliant! Thanks a lot, that really did it for me.... If i can change the title of the post to describe the issue better and make it easier to find for people encountering the same issue, let me know.
    – Skeboo
    Commented Nov 4, 2016 at 15:26
  • No worries, the only thanks i need is that little tick next to the answer being clicked. Commented Nov 4, 2016 at 15:29
  • Do you see any easy way to automatize this process? in R maybe (with the coordinates of the points, the admin subdivision map and the urban areas map as input files)?
    – Skeboo
    Commented Nov 9, 2016 at 11:54
  • Sorry but that's a little out of my experience. I'm guessing it could be possible through the graphic modeller, but that's probably as automated as I could get. Why not post it as a question? Commented Nov 9, 2016 at 12:04
  • I tried it and got it to work actually. It is fairly simple i must say... The graphic modeller does the work nicely, all the different steps are replicated smoothly (one can search for the right 'tool' of each step in the algorithm section of the modeller). Thanks again...
    – Skeboo
    Commented Nov 16, 2016 at 11:04

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.