I have 2 vector layers of points:

  • one with a point for each house in the city (thanks to osm.org), roughly equivalent to population
  • one with a point for each case of cholera in the city

I'm trying to define in which locations I should site new water supply points based on a local attack rate (ie: number of cholera cases / local population). I've built separate heat maps for each layer (using QGIS heat map plugin), but it's hard to visually figure out hot spots.

So I'm looking for a way to calculate this local attack rate, ideally something like (number of cases within X meters radius / number of houses within same radius) and spit that out as a raster layer. Basically just like a heat map, but using a ratio rather than a simple count.

I'm guessing there's some magic keyword I don't know that will open a swath of solutions. Can anyone point me in the right direction? I'm using QGIS.

  • The magic word may be "density": you are asking for the ratio of two density maps.
    – whuber
    Commented Oct 11, 2013 at 16:40

1 Answer 1


Here's what I found:

  • make a heatmap of each layer using the Raster->Heatmap plugin.
  • use raster->raster calculator to compute the ratio

this seems to give me what I want, the only caveat being that I'm not 100% sure how the calculation is done, considering that my two heatmaps pixels don't perfectly overlap. I read something hinting at "nearest neighbour" algorithm being used in such situation, but I'm not sure how that would affect my result.

  • 1
    You need to control the output. Most software computes defaults for the kernel and its radius based on the number of data points and their extent; you probably should override at least one of those defaults if you would like the results to overlap.
    – whuber
    Commented Oct 14, 2013 at 14:35
  • Yes, I saw the pixel size settings, but I'm still unsure about shifting the grid so that both rasters actually overlap. Or maybe it doesn't matter if pixels are the same size?
    – Laurent S
    Commented Oct 14, 2013 at 15:42

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.